Here are the examples of the csharp api NUnit.Framework.Assert.AreEqual(object, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
25612 Examples
19
View Source File : _3MatrixTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertMatrixIsIdenreplacedy()
{
var result = matrix.MultiplyByAnotherMatrix(matrix);
replacedert.AreEqual(result.GetValueAt(1, 1), 1m);
replacedert.AreEqual(result.GetValueAt(2, 2), 1m);
replacedert.AreEqual(result.GetValueAt(3, 3), 1m);
replacedert.AreEqual(result.GetValueAt(1, 2), 0m);
replacedert.AreEqual(result.GetValueAt(1, 3), 0m);
replacedert.AreEqual(result.GetValueAt(2, 1), 0m);
replacedert.AreEqual(result.GetValueAt(2, 3), 0m);
replacedert.AreEqual(result.GetValueAt(3, 1), 0m);
replacedert.AreEqual(result.GetValueAt(3, 2), 0m);
}
19
View Source File : _nMatrixTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertMatrixMultiplicationTest1()
{
var result = matrix.MultiplyByAnotherMatrix(matrix2);
replacedert.AreEqual(result.GetValueAt(1, 1), 182m);
replacedert.AreEqual(result.GetValueAt(2, 2), 1539m);
replacedert.AreEqual(result.GetValueAt(3, 3), 1106m);
replacedert.AreEqual(result.GetValueAt(4, 4), 3847m);
replacedert.AreEqual(result.GetValueAt(5, 5), 11582m);
replacedert.AreEqual(result.GetValueAt(6, 6), 3165m);
replacedert.AreEqual(result.GetValueAt(2, 1), 753m);
replacedert.AreEqual(result.GetValueAt(3, 1), 227m);
replacedert.AreEqual(result.GetValueAt(4, 1), 2497m);
replacedert.AreEqual(result.GetValueAt(5, 1), 887m);
replacedert.AreEqual(result.GetValueAt(6, 1), 1877m);
replacedert.AreEqual(result.GetValueAt(1, 2), 419m);
replacedert.AreEqual(result.GetValueAt(3, 2), 326m);
replacedert.AreEqual(result.GetValueAt(4, 2), 3796m);
replacedert.AreEqual(result.GetValueAt(5, 2), 1976m);
replacedert.AreEqual(result.GetValueAt(6, 2), 2746m);
replacedert.AreEqual(result.GetValueAt(1, 3), 1827m);
replacedert.AreEqual(result.GetValueAt(2, 3), 6400m);
replacedert.AreEqual(result.GetValueAt(4, 3), 13006m);
replacedert.AreEqual(result.GetValueAt(5, 3), 9616m);
replacedert.AreEqual(result.GetValueAt(6, 3), 9416m);
replacedert.AreEqual(result.GetValueAt(1, 4), 279m);
replacedert.AreEqual(result.GetValueAt(2, 4), 886m);
replacedert.AreEqual(result.GetValueAt(3, 4), 407m);
replacedert.AreEqual(result.GetValueAt(5, 4), 2137m);
replacedert.AreEqual(result.GetValueAt(6, 4), 2557m);
replacedert.AreEqual(result.GetValueAt(1, 5), 2636m);
replacedert.AreEqual(result.GetValueAt(2, 5), 9442m);
replacedert.AreEqual(result.GetValueAt(3, 5), 1322m);
replacedert.AreEqual(result.GetValueAt(4, 5), 17082m);
replacedert.AreEqual(result.GetValueAt(6, 5), 13002m);
replacedert.AreEqual(result.GetValueAt(1, 6), 378m);
replacedert.AreEqual(result.GetValueAt(2, 6), 1212m);
replacedert.AreEqual(result.GetValueAt(3, 6), 485m);
replacedert.AreEqual(result.GetValueAt(4, 6), 4925m);
replacedert.AreEqual(result.GetValueAt(5, 6), 2485m);
}
19
View Source File : _nMatrixTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertTransposeTest1()
{
var transpose = matrix.ReturnTranspose(matrix);
replacedert.AreEqual(transpose.GetValueAt(1, 1), matrix.GetValueAt(1, 1));
replacedert.AreEqual(transpose.GetValueAt(2, 2), matrix.GetValueAt(2, 2));
replacedert.AreEqual(transpose.GetValueAt(3, 3), matrix.GetValueAt(3, 3));
replacedert.AreEqual(transpose.GetValueAt(4, 4), matrix.GetValueAt(4, 4));
replacedert.AreEqual(transpose.GetValueAt(5, 5), matrix.GetValueAt(5, 5));
replacedert.AreEqual(transpose.GetValueAt(6, 6), matrix.GetValueAt(6, 6));
replacedert.AreEqual(transpose.GetValueAt(2, 1), matrix.GetValueAt(1, 2));
replacedert.AreEqual(transpose.GetValueAt(3, 1), matrix.GetValueAt(1, 3));
replacedert.AreEqual(transpose.GetValueAt(4, 1), matrix.GetValueAt(1, 4));
replacedert.AreEqual(transpose.GetValueAt(5, 1), matrix.GetValueAt(1, 5));
replacedert.AreEqual(transpose.GetValueAt(6, 1), matrix.GetValueAt(1, 6));
//replacedert.AreEqual(transpose.GetValueAt(1, 2), 419m);
//replacedert.AreEqual(transpose.GetValueAt(3, 2), 326m);
//replacedert.AreEqual(transpose.GetValueAt(4, 2), 3796m);
//replacedert.AreEqual(transpose.GetValueAt(5, 2), 1976m);
//replacedert.AreEqual(transpose.GetValueAt(6, 2), 2746m);
//replacedert.AreEqual(transpose.GetValueAt(1, 3), 1827m);
//replacedert.AreEqual(transpose.GetValueAt(2, 3), 6400m);
//replacedert.AreEqual(transpose.GetValueAt(4, 3), 13006m);
//replacedert.AreEqual(transpose.GetValueAt(5, 3), 9616m);
//replacedert.AreEqual(transpose.GetValueAt(6, 3), 9416m);
//replacedert.AreEqual(transpose.GetValueAt(1, 4), 279m);
//replacedert.AreEqual(transpose.GetValueAt(2, 4), 886m);
//replacedert.AreEqual(transpose.GetValueAt(3, 4), 407m);
//replacedert.AreEqual(transpose.GetValueAt(5, 4), 2137m);
//replacedert.AreEqual(transpose.GetValueAt(6, 4), 2557m);
//replacedert.AreEqual(transpose.GetValueAt(1, 5), 2636m);
//replacedert.AreEqual(transpose.GetValueAt(2, 5), 9442m);
//replacedert.AreEqual(transpose.GetValueAt(3, 5), 1322m);
//replacedert.AreEqual(transpose.GetValueAt(4, 5), 17082m);
//replacedert.AreEqual(transpose.GetValueAt(6, 5), 13002m);
//replacedert.AreEqual(transpose.GetValueAt(1, 6), 378m);
//replacedert.AreEqual(transpose.GetValueAt(2, 6), 1212m);
//replacedert.AreEqual(transpose.GetValueAt(3, 6), 485m);
//replacedert.AreEqual(transpose.GetValueAt(4, 6), 4925m);
//replacedert.AreEqual(transpose.GetValueAt(5, 6), 2485m);
}
19
View Source File : _nMatrixTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertIdenreplacedyMatrix()
{
var result = idenreplacedy;
replacedert.AreEqual(result.GetValueAt(1, 1), 1);
replacedert.AreEqual(result.GetValueAt(2, 2), 1);
replacedert.AreEqual(result.GetValueAt(3, 3), 1);
replacedert.AreEqual(result.GetValueAt(4, 4), 1);
replacedert.AreEqual(result.GetValueAt(5, 5), 1);
replacedert.AreEqual(result.GetValueAt(6, 6), 1);
replacedert.AreEqual(result.GetValueAt(2, 1), 0);
replacedert.AreEqual(result.GetValueAt(3, 1), 0);
replacedert.AreEqual(result.GetValueAt(4, 1), 0);
replacedert.AreEqual(result.GetValueAt(5, 1), 0);
replacedert.AreEqual(result.GetValueAt(6, 1), 0);
replacedert.AreEqual(result.GetValueAt(1, 2), 0);
replacedert.AreEqual(result.GetValueAt(3, 2), 0);
replacedert.AreEqual(result.GetValueAt(4, 2), 0);
replacedert.AreEqual(result.GetValueAt(5, 2), 0);
replacedert.AreEqual(result.GetValueAt(6, 2), 0);
replacedert.AreEqual(result.GetValueAt(1, 3), 0);
replacedert.AreEqual(result.GetValueAt(2, 3), 0);
replacedert.AreEqual(result.GetValueAt(4, 3), 0);
replacedert.AreEqual(result.GetValueAt(5, 3), 0);
replacedert.AreEqual(result.GetValueAt(6, 3), 0);
replacedert.AreEqual(result.GetValueAt(1, 4), 0);
replacedert.AreEqual(result.GetValueAt(2, 4), 0);
replacedert.AreEqual(result.GetValueAt(3, 4), 0);
replacedert.AreEqual(result.GetValueAt(5, 4), 0);
replacedert.AreEqual(result.GetValueAt(6, 4), 0);
replacedert.AreEqual(result.GetValueAt(1, 5), 0);
replacedert.AreEqual(result.GetValueAt(2, 5), 0);
replacedert.AreEqual(result.GetValueAt(3, 5), 0);
replacedert.AreEqual(result.GetValueAt(4, 5), 0);
replacedert.AreEqual(result.GetValueAt(6, 5), 0);
replacedert.AreEqual(result.GetValueAt(1, 6), 0);
replacedert.AreEqual(result.GetValueAt(2, 6), 0);
replacedert.AreEqual(result.GetValueAt(3, 6), 0);
replacedert.AreEqual(result.GetValueAt(4, 6), 0);
replacedert.AreEqual(result.GetValueAt(5, 6), 0);
}
19
View Source File : _nMatrixTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertInsertSquareSubMatrix()
{
var idenreplacedyClreplaced = new nIdenreplacedyMatrix();
var idenreplacedy = idenreplacedyClreplaced.ReturnNIdenreplacedyMatrix(6);
idenreplacedy.InsertSubMatrix(subMatrix, 3);
replacedert.AreEqual(idenreplacedy.GetValueAt(4, 4), 1);
replacedert.AreEqual(idenreplacedy.GetValueAt(5, 5), 4);
replacedert.AreEqual(idenreplacedy.GetValueAt(6, 6), 21);
replacedert.AreEqual(idenreplacedy.GetValueAt(5, 4), 3);
replacedert.AreEqual(idenreplacedy.GetValueAt(6, 4), 5);
}
19
View Source File : ThreadBasedLoopingTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
License : BSD 3-Clause "New" or "Revised" License
Project Creator : ActuarialIntelligence
[Test]
public void replacedertBreaksWork()
{
int remainder;
decimal increment = 0.2m;
decimal initialValue = 1m;
int i = 0;//Loop counter.
int tasks = 5;
var noOfIncrements = (int)(((6.2m - 1m) / 0.2m));
var breaks = Math.DivRem(noOfIncrements, tasks, out remainder);
replacedert.AreEqual(breaks, 5);
replacedert.AreEqual(remainder, 1);
replacedert.AreEqual(initialValue + (i * breaks), 1m);
replacedert.AreEqual(initialValue + ((i + 1) * breaks * increment), 2m);
replacedert.AreEqual(initialValue + ((tasks - 1) * breaks * increment), 5m);
replacedert.AreEqual(initialValue + ((tasks * breaks * increment) + (remainder * increment)), 6.2m);
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void IsInitializedStateChangesWhenCallingInit()
{
var initializedBeforeCallingInit = FormsVideoPlayer.IsInitialized;
FormsVideoPlayer.Init();
var initializedAfterCallingInit = FormsVideoPlayer.IsInitialized;
replacedert.IsFalse(initializedBeforeCallingInit);
replacedert.IsTrue(initializedAfterCallingInit);
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Trial);
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void NoLicenseKeyPreplacededToInit()
{
FormsVideoPlayer.Init();
replacedert.IsTrue(FormsVideoPlayer.IsInitialized, "FormsVideoPlayer.IsInitialized");
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Trial, "License should be in trial mode.");
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void ValidLicenseKeyPreplacededToInit()
{
var licenseKey = "C79CA697B72791E4736758C520B92146945ECED1";
FormsVideoPlayer.Init(licenseKey);
replacedert.IsTrue(FormsVideoPlayer.IsInitialized, "FormsVideoPlayer.IsInitialized");
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Full, "License should be in full mode.");
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void InvalidLicenseKeyPreplacededToInit()
{
var licenseKey = "07C54D83E0CC806F017B369D33E755E8253E8F95";
replacedert.Catch<VideoPlayerLicenseException>(() => FormsVideoPlayer.Init(licenseKey), "FormsVideoPlayer.Init(licenseKey)");
replacedert.IsFalse(FormsVideoPlayer.IsInitialized, "FormsVideoPlayer.IsInitialized");
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Trial, "License should be in trial mode.");
}
19
View Source File : PlatformFeaturesTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void HashSha1()
{
var platformFeatures = new PlatformFeatures();
var hashedValue = platformFeatures.HashSha1("com.MyPackage.AppName");
replacedert.AreEqual(hashedValue.ToUpper(), "7604D67F58F960D8A8F2B8558269F649F7904ED8",
"Hashing a string does not produce the expected SHA-1 hash.");
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void ValidLicenseKeyPreplacededToInit()
{
var licenseKey = "AB0FAF4003456ECFE1F606BB343AA306D3D153E9";
FormsVideoPlayer.Init(licenseKey);
replacedert.IsTrue(FormsVideoPlayer.IsInitialized, "FormsVideoPlayer.IsInitialized");
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Full, "License should be in full mode.");
}
19
View Source File : FormsVideoPlayerTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void ValidLicenseKeyPreplacededToInit()
{
var licenseKey = "5C67C48C3C6B0E084EB9760E94F9E4C65417C6C1";
FormsVideoPlayer.Init(licenseKey);
replacedert.IsTrue(FormsVideoPlayer.IsInitialized, "FormsVideoPlayer.IsInitialized");
replacedert.AreEqual(VideoPlayerLicense.LicenseType, LicenseType.Full, "License should be in full mode.");
}
19
View Source File : PlatformFeaturesTests.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
[Test]
public void PackageNameTests()
{
var platformFeatures = new PlatformFeatures();
var appIdentifier = platformFeatures.PackageName;
replacedert.AreEqual(appIdentifier, "Octane.Xam.VideoPlayer.Android.Tests",
"The package name is not coming back as expected.");
}
19
View Source File : CoverletResultParsingTests.cs
License : MIT License
Project Creator : ademanuele
License : MIT License
Project Creator : ademanuele
[Test]
public void TestCase()
{
Stream resultsStream = SampleResultsStream();
CoverletResultsParser parser = new CoverletResultsParser();
var parsedResults = parser.ParseFrom(resultsStream);
replacedert.AreEqual(parsedResults.ModuleCoverage.Count, 2);
}
19
View Source File : Food_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void NewFoodTest()
{
// Check default Food image has been created
replacedert.AreNotEqual(null, Food.FoodImage[1, 1].Image);
replacedert.AreEqual("FoodImage0", Food.FoodImage[1, 1].Name);
}
19
View Source File : Food_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void AmountOfFoodTest()
{
// Check amount of food
replacedert.AreEqual(240, Food.Amount);
}
19
View Source File : Food_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void EatFoodTest()
{
// Eat food
Food.EatFood(1, 1);
replacedert.AreEqual(false, Food.FoodImage[1, 1].Visible);
}
19
View Source File : FormElements_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void CreateFormElementsTest()
{
// Check Form Elements have been created
FormElements.CreateFormElements(new Form());
replacedert.AreEqual("1UP", FormElements.PlayerOneScoreText.Text);
replacedert.AreEqual("HIGH SCORE", FormElements.HighScoreText.Text);
}
19
View Source File : GameBoard_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void NewGameBoardTest()
{
// Check default Game Board image has been created
GameBoard.CreateBoardImage(new Form(),1);
replacedert.AreNotEqual(null, GameBoard.BoardImage.Image);
replacedert.AreEqual(0, GameBoard.BoardImage.Left);
replacedert.AreEqual(50, GameBoard.BoardImage.Top);
replacedert.AreEqual("BoardImage", GameBoard.BoardImage.Name);
}
19
View Source File : GameBoard_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void GameBoardMatrixTest()
{
// Check Board Matrix for start position
replacedert.AreEqual(new Tuple<int,int> (9,17), GameBoard.InitialiseBoardMatrix(1));
}
19
View Source File : HighScore_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void CreateHighScoreTest()
{
// Check High Score has been created
HighScore.CreateHighScore(new Form());
replacedert.AreEqual(HighScore.InitalScore.ToString(), HighScore.HighScoreText.Text);
}
19
View Source File : Pacman_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void NewPacmanTest()
{
// Check default Pacman values
replacedert.AreEqual(0, pacman.xCoordinate);
replacedert.AreEqual(0, pacman.yCoordinate);
replacedert.AreEqual(0, pacman.currentDirection);
replacedert.AreEqual(0, pacman.nextDirection);
}
19
View Source File : Pacman_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void CreatePacmanTest()
{
// Check default Pacman image has been created
pacman.CreatePacmanImage(new Form(),0,0);
replacedert.AreNotEqual(null, pacman.PacmanImage.Image);
replacedert.AreEqual(-3, pacman.PacmanImage.Left);
replacedert.AreEqual(43, pacman.PacmanImage.Top);
replacedert.AreEqual("PacmanImage", pacman.PacmanImage.Name);
}
19
View Source File : Player_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void NewPlayerTest()
{
// Check default Player
replacedert.AreEqual(0, player.Score);
replacedert.AreEqual(3, player.Lives);
}
19
View Source File : Player_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void CreateScoreLabelTest()
{
// Check default Player
replacedert.AreEqual("0", player.ScoreText.Text);
}
19
View Source File : Player_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void UpdateScoreTest()
{
// Check default Player
player.UpdateScore(10);
replacedert.AreEqual(10, player.Score);
}
19
View Source File : Player_Test.cs
License : MIT License
Project Creator : adrianeyre
License : MIT License
Project Creator : adrianeyre
[Test]
public void CreateLivesTest()
{
// Check default Player
replacedert.AreNotEqual(null, player.LifeImage[0]);
replacedert.AreEqual(false, player.LifeImage[5].Visible);
}
19
View Source File : EnumPropertyTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Ctor_ShouldSelectFirstValue()
{
replacedert.AreEqual(mSut.Values.First(), mSut.SelectedValue);
}
19
View Source File : NumericPropertyTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Ctor_ShouldSetDefaultValue()
{
NumericProperty<int> sut = new NumericProperty<int>("Num Prop:", "numProp", 1234);
replacedert.AreEqual(sut.Value, 1234.ToString());
}
19
View Source File : NumericPropertyTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldCreateAndAppendCorrectElement_WhenNotDefault()
{
NumericProperty<int> sut = CreateSut<int>();
const string value = "10000";
sut.Value = value;
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
sut.Save(xmlDoc, appender);
XmlElement numProp = appender["numProp"];
replacedert.IsNotNull(numProp);
replacedert.AreEqual(value, numProp.Attributes["value"].Value);
}
19
View Source File : AditivityTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Name_ShouldBeInitializedCorrectly()
{
replacedert.AreEqual("Aditivity:", mSut.Name);
}
19
View Source File : AditivityTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldSaveIfNotAditive()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement logger = xmlDoc.CreateElement("logger");
mSut.Value = false;
mSut.Save(xmlDoc, logger);
replacedert.AreEqual("False", logger.Attributes?["aditivity"].Value);
}
19
View Source File : BackColorTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Colors_ShouldBeInitializedProperly()
{
replacedert.AreEqual(Enum.GetValues(typeof(ConsoleColor)).Cast<ConsoleColor>(), mSut.Colors);
}
19
View Source File : BackColorTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Name_ShouldBeInitializedCorrectly()
{
replacedert.AreEqual("Background:", mSut.Name);
}
19
View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldNotSaveAppendTo_WhenOverwriteIsFalse()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
mSut.Save(xmlDoc, appender);
//1 for file
replacedert.AreEqual(1, appender.ChildNodes.Count);
}
19
View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldSaveAppendTo_WhenOverwriteIsTrue()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
mSut.Overwrite = true;
mSut.Save(xmlDoc, appender);
XmlNode appendToNode = appender.SelectSingleNode("appendToFile");
replacedert.IsNotNull(appendToNode);
replacedert.AreEqual("false", appendToNode.Attributes?["value"].Value);
}
19
View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldSaveFilePath()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
mSut.FilePath = "filepath";
mSut.Save(xmlDoc, appender);
XmlNode fileNode = appender.SelectSingleNode("file");
replacedert.IsNotNull(fileNode);
replacedert.AreEqual("filepath", fileNode.Attributes?["value"].Value);
}
19
View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldSavePatternString_WhenPatternStringIsTrue()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
mSut.PatternString = true;
mSut.Save(xmlDoc, appender);
XmlNode fileNode = appender.SelectSingleNode("file");
replacedert.AreEqual("log4net.Util.PatternString", fileNode?.Attributes?["type"].Value);
}
19
View Source File : FiltersTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void MoveUp_ShouldDecrementFilterIndex()
{
mSut.AddFilter.Execute(FilterDescriptor.DenyAll);
mSut.AddFilter.Execute(FilterDescriptor.DenyAll);
(FilterModel firstFilter, int firstFilterIndex) = (mSut.ExistingFilters.First(), 0);
(FilterModel secondFilter, int secondFilterIndex) = (mSut.ExistingFilters.Skip(1).First(), 1);
//Test sanity check
replacedert.AreEqual(firstFilterIndex, mSut.ExistingFilters.IndexOf(firstFilter));
replacedert.AreEqual(secondFilterIndex, mSut.ExistingFilters.IndexOf(secondFilter));
secondFilter.MoveUp.Execute(null);
replacedert.AreEqual(secondFilterIndex, mSut.ExistingFilters.IndexOf(firstFilter));
replacedert.AreEqual(firstFilterIndex, mSut.ExistingFilters.IndexOf(secondFilter));
}
19
View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldReduceRefCountToOne()
{
XmlElement loggerElement = mXmlDoc.CreateElement("logger");
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
{
new LoggerModel(loggerElement, true, LoggerDescriptor.Logger)
};
mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));
XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");
replacedert.IsNotNull(appenderRefs);
replacedert.AreEqual(1, appenderRefs.Count);
}
19
View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldRemoveExistingRefs_WhenNotEnabled()
{
XmlElement loggerElement = mXmlDoc.CreateElement("logger");
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
{
new LoggerModel(loggerElement, false, LoggerDescriptor.Logger)
};
mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));
XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");
replacedert.IsNotNull(appenderRefs);
replacedert.AreEqual(0, appenderRefs.Count);
}
19
View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldRemoveExistingRefs_WhenNotEnabled_AndNameHasChanged()
{
XmlElement loggerElement = mXmlDoc.CreateElement("logger");
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
{
new LoggerModel(loggerElement, false, LoggerDescriptor.Logger)
};
//Original name is "appender0"
mNameProperty.Value = "someOtherName";
mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));
XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}' or @ref='{mNameProperty.OriginalName}']");
replacedert.IsNotNull(appenderRefs);
replacedert.AreEqual(0, appenderRefs.Count);
}
19
View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldRemoveOldIncomingRefs_WhenNameHasChanged_AndRefIsEnabled()
{
//Original name is "appender0"
mNameProperty.Value = "someOtherName";
//Let's try to add a ref to the asyncAppender (which already exists with the original name)
IAcceptAppenderRef loggerModel = mSut.RefsCollection.First(r => ((NamedModel)r).Name == "asyncAppender");
loggerModel.IsEnabled = true;
mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));
//Selects all "appender-ref" nodes with the "ref" attribute
XmlNodeList appenderRefs = loggerModel.Node.SelectNodes("appender-ref[@ref]");
replacedert.IsNotNull(appenderRefs);
replacedert.AreEqual(1, appenderRefs.Count);
replacedert.AreEqual("someOtherName", appenderRefs[0].Attributes["ref"].Value);
}
19
View Source File : MinLevelTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[TestCase("<levelMin />", "")]
[TestCase("<levelMin value=\"\" />", "")]
[TestCase("<levelMin value=\"ALL\" />", "ALL")]
[TestCase("<levelMin value=\"All\" />", "ALL")]
[TestCase("<levelMin value=\"all\" />", "ALL")]
public void Load_ShouldLoadTheCorrectValue(string xml, string expected)
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
xmlDoc.LoadXml("<appender>\n" +
$" {xml}\n" +
"</appender>");
mSut.Load(xmlDoc.FirstChild);
replacedert.AreEqual(expected, mSut.SelectedValue);
}
19
View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[TestCase(null)]
[TestCase("<rollingStyle />")]
[TestCase("<rollingStyle value=\"\" />")]
[TestCase("<rollingStyle value=\"whatev\" />")]
public void Load_ShouldNotLoadMode(string mode)
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
xmlDoc.LoadXml("<appender type=\"log4net.Appender.RollingFileAppender\" name=\"rolling\">\n" +
$" {mode}\n" +
" </appender>");
mSut.Load(xmlDoc.FirstChild);
replacedert.AreEqual(RollingFileAppender.RollingMode.Composite, mSut.SelectedMode);
}
19
View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Load_ShouldLoadMode()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
xmlDoc.LoadXml("<appender type=\"log4net.Appender.RollingFileAppender\" name=\"rolling\">\n" +
" <rollingStyle value=\"Date\" />\n" +
" </appender>");
mSut.Load(xmlDoc.FirstChild);
replacedert.AreEqual(RollingFileAppender.RollingMode.Date, mSut.SelectedMode);
}
19
View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void Save_ShouldSave_WhenNotComposite()
{
XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
XmlElement appender = xmlDoc.CreateElement("appender");
mSut.SelectedMode = RollingFileAppender.RollingMode.Date;
mSut.Save(xmlDoc, appender);
XmlNode rollingStyleNode = appender.SelectSingleNode("rollingStyle");
replacedert.IsNotNull(rollingStyleNode);
replacedert.AreEqual("Date", rollingStyleNode.Attributes["value"].Value);
}
19
View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void SelectedMode_ShouldBeInitializedToComposite()
{
replacedert.AreEqual(RollingFileAppender.RollingMode.Composite, mSut.SelectedMode);
}
19
View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
[Test]
public void SelectedMode_ShouldFirePropChange_AndChange_WhenValueHasChanged()
{
bool fired = false;
mSut.PropertyChanged += (sender, args) => { fired = true; };
mSut.SelectedMode = RollingFileAppender.RollingMode.Date;
replacedert.IsTrue(fired);
replacedert.AreEqual(RollingFileAppender.RollingMode.Date, mSut.SelectedMode);
}
See More Examples