NUnit.Framework.Assert.AreEqual(object, object)

Here are the examples of the csharp api class NUnit.Framework.Assert.AreEqual(object, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

51. Example

Project: AutoTest.Net
Source File: TestInfoTests.cs
View license
private void CheckConstructionFromTest( ITest expected )
		{
			TestInfo actual = new TestInfo( expected );
			Assert.AreEqual( expected.TestName, actual.TestName );
			Assert.AreEqual( expected.TestType, actual.TestType );
			Assert.AreEqual( expected.RunState, actual.RunState );
			Assert.AreEqual( expected.IsSuite, actual.IsSuite, "IsSuite" );
			Assert.AreEqual( expected.TestCount, actual.TestCount, "TestCount" );

			if ( expected.Categories == null )
				Assert.AreEqual( 0, actual.Categories.Count, "Categories" );
			else
			{
				Assert.AreEqual( expected.Categories.Count, actual.Categories.Count, "Categories" );
				for ( int index = 0; index < expected.Categories.Count; index++ )
					Assert.AreEqual( expected.Categories[index], actual.Categories[index], "Category {0}", index );
			}

			Assert.AreEqual( expected.TestName, actual.TestName, "TestName" );
		}

52. Example

Project: AutoTest.Net
Source File: PathUtilTests.cs
View license
[Test]
		public void CheckDefaults()
		{
			Assert.AreEqual( Path.DirectorySeparatorChar, PathUtils.DirectorySeparatorChar );
			Assert.AreEqual( Path.AltDirectorySeparatorChar, PathUtils.AltDirectorySeparatorChar );
		}

53. Example

Project: AutoTest.Net
Source File: TestAssert.cs
View license
public static void IsRunnable(Test test)
        {
            Assert.AreEqual(RunState.Runnable, test.RunState);
        }

54. Example

Project: AutoTest.Net
Source File: MoneyTest.cs
View license
[Test]
		public void BagSumAdd() 
		{
			// {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]}
			Money[] bag= { new Money(26, "CHF"), new Money(28, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, fMB1.Add(fMB2));
		}

55. Example

Project: AutoTest.Net
Source File: MoneyTest.cs
View license
[Test]
		public void Normalize2() 
		{
			// {[12 CHF][7 USD]} - [12 CHF] == [7 USD]
			Money expected= new Money(7, "USD");
			Assert.AreEqual(expected, fMB1.Subtract(f12CHF));
		}

56. Example

Project: AutoTest.Net
Source File: LegacySuiteTests.cs
View license
[Test]
        public void SuiteReturningTestSuite()
        {
            Test suite = builder.BuildFrom(typeof(NUnit.Core.Tests.AllTests));
            Assert.AreEqual(RunState.Runnable, suite.RunState);
            Assert.AreEqual(3, suite.Tests.Count);
            Assert.AreEqual(11, suite.TestCount);
        }

57. Example

Project: AutoTest.Net
Source File: NameFilterTest.cs
View license
[Test]
		public void HighLevelSuite() 
		{
			NUnit.Core.TestSuite mockTest = (NUnit.Core.TestSuite) TestFinder.Find("MockTestFixture", testSuite, true);
			NameFilter filter = new NameFilter(testSuite.TestName);
			Assert.AreEqual( true, filter.Pass(mock3), "test case");
			Assert.AreEqual( true, filter.Pass(mockTest), "middle suite");
			Assert.AreEqual( true, filter.Pass(testSuite), "test suite");
		}

58. Example

Project: AutoTest.Net
Source File: TestSuiteTest.cs
View license
[Test]
		public void RunSuiteByCategory() 
		{
			TestSuite testSuite = new TestSuite("Mock Test Suite");
			testSuite.Add(mockTestFixture);

			CategoryFilter filter = new CategoryFilter();
			filter.AddCategory("FixtureCategory");
			RecordingListener listener = new RecordingListener();
			testSuite.Run(listener, filter);
			Assert.AreEqual(MockTestFixture.ResultCount, listener.testStarted.Count);
		}

59. Example

Project: AutoTest.Net
Source File: BasicRunnerTests.cs
View license
[Test]
		public void CountTestCasesAcrossMultipleAssemblies()
		{
			runner.Load(package2);
			Assert.AreEqual( NoNamespaceTestFixture.Tests + MockAssembly.Tests, 
				runner.Test.TestCount );			
		}

60. Example

Project: AutoTest.Net
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceCanBeStaticField(
            [ValueSource("StaticField")] string source)
        {
            Assert.AreEqual("StaticField", source);
        }

61. Example

View license
[Test]
        public void CanReturnWithoutParameters()
        {
            Assert.AreEqual("Foo`2", GenericNameMangler.MangleTypeName("Foo<Bar<T>,V>"));
        }

62. Example

View license
[Test]
        public void SetResult_Inconclusive()
        {
            TestSuiteTreeNode node = new TestSuiteTreeNode(testCaseInfo);
            TestResult result = new TestResult(testCaseInfo);

            result.SetResult(ResultState.Inconclusive, null, null);
            node.Result = result;
            Assert.AreEqual("MockTest1", node.Result.Name);
            Assert.AreEqual(TestSuiteTreeNode.InconclusiveIndex, node.ImageIndex);
            Assert.AreEqual(TestSuiteTreeNode.InconclusiveIndex, node.SelectedImageIndex);
            Assert.AreEqual(result.ResultState.ToString(), node.StatusText);
        }

63. Example

Project: AutoTest.Net
Source File: ExpectExceptionTest.cs
View license
[Test]
		public void AssertFailBeforeException() 
		{ 
			TestResult suiteResult = TestBuilder.RunTestFixture( typeof (TestAssertsBeforeThrowingException) );
			Assert.AreEqual( ResultState.Failure, suiteResult.ResultState );
			TestResult result = (TestResult)suiteResult.Results[0];
			Assert.AreEqual( "private message", result.Message );
		}

64. Example

Project: AutoTest.Net
Source File: LegacySuiteTests.cs
View license
[Test]
        public void SuiteReturningFixtures()
        {
            Test suite = builder.BuildFrom(typeof(LegacySuiteReturningFixtures));
            Assert.AreEqual(RunState.Runnable, suite.RunState);
            Assert.AreEqual(3, suite.Tests.Count);
            Assert.AreEqual(11, suite.TestCount);
        }

65. Example

Project: AutoTest.Net
Source File: CategoryManagerTest.cs
View license
[Test]
		public void CanAddStringsWithoutDuplicating() 
		{
			categoryManager.Clear();
			string name1 = "Name1";
			string name2 = "Name2";
			string duplicate1 = "Name1";

			categoryManager.Add(name1);
			categoryManager.Add(name2);
			categoryManager.Add(duplicate1);

			Assert.AreEqual(2, categoryManager.Categories.Count);
		}

66. Example

Project: AutoTest.Net
Source File: EqualsFixture.cs
View license
[Test, ExpectedException( typeof(AssertionException) )]
		public void EnumsNotEqual()
		{
			MyEnum actual = MyEnum.a;
			expectedMessage =
				"  Expected: c" + Environment.NewLine +
				"  But was:  a" + Environment.NewLine;
			Assert.AreEqual( MyEnum.c, actual );
		}

67. Example

Project: AutoTest.Net
Source File: ExpectExceptionTest.cs
View license
[Test]
		public void AssertFailBeforeException() 
		{ 
			TestResult suiteResult = TestBuilder.RunTestFixture( typeof (TestAssertsBeforeThrowingException) );
			Assert.AreEqual( ResultState.Failure, suiteResult.ResultState );
			TestResult result = (TestResult)suiteResult.Results[0];
			Assert.AreEqual( "private message", result.Message );
		}

68. Example

View license
[Test]
		public void TypeSafeSettings()
		{
			storage.SaveSetting( "X", 5);
			storage.SaveSetting( "Y", "17" );
			storage.SaveSetting( "NAME", "Charlie");

			Assert.AreEqual( 5, storage.GetSetting("X") );
			Assert.AreEqual( "17", storage.GetSetting( "Y" ) );
			Assert.AreEqual( "Charlie", storage.GetSetting( "NAME" ) );
		}

69. Example

Project: AutoTest.Net
Source File: CommandLineTests.cs
View license
[Test]
		public void AssemblyName()
		{
			ConsoleOptions options = new ConsoleOptions( "nunit.tests.dll" );
			Assert.AreEqual( "nunit.tests.dll", options.Parameters[0] );
		}

70. Example

View license
[TestCaseSource("frameworkData")]
        public void CanDisplayFrameworkAsString(FrameworkData data)
        {
            RuntimeFramework framework = new RuntimeFramework(data.runtime, data.frameworkVersion);
            Assert.AreEqual(data.representation, framework.ToString());
            Assert.AreEqual(data.displayName, framework.DisplayName);
        }

71. Example

Project: AutoTest.Net
Source File: NUnitProjectTests.cs
View license
[Test]
		public void RenameActiveConfig()
		{
			project.Configs.Add( "Old" );
			project.SetActiveConfig( "Old" );
			project.Configs[0].Name = "New";
			Assert.AreEqual( "New", project.ActiveConfig.Name );
		}

72. Example

Project: AutoTest.Net
Source File: TestNameTests.cs
View license
[Test]
		public void CanParseStrongTestNames()
		{
			TestName testName = TestName.Parse( strongName1.UniqueName );
			Assert.AreEqual( strongName1, testName );

			strongName1.RunnerID = 7;
			testName = TestName.Parse( strongName1.UniqueName );
			Assert.AreEqual( strongName1, testName );
		}

73. Example

Project: AutoTest.Net
Source File: SuiteBuilderTests.cs
View license
[Test]
		public void WrongReturnTypeSuite()
		{
			TestPackage package = new TestPackage( testData );
			package.TestName = "NUnit.TestData.LegacySuiteData.NonConformingSuite";
			Test suite = builder.Build( package );
			Assert.AreEqual(RunState.NotRunnable, suite.RunState);
            Assert.AreEqual("Suite property must return either TestSuite or IEnumerable", suite.IgnoreReason);
		}

74. Example

Project: AutoTest.Net
Source File: LegacySuiteTests.cs
View license
[Test]
        public void SuiteReturningFixtureWithArguments()
        {
            Test suite = builder.BuildFrom(typeof(LegacySuiteReturningFixtureWithArguments));
            Assert.AreEqual(RunState.Runnable, suite.RunState);
            Assert.AreEqual(1, suite.Tests.Count);
            Assert.AreEqual(0, suite.TestCount);
        }

75. Example

Project: AutoTest.Net
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceCanBeInstanceProperty(
            [ValueSource("InstanceProperty")] string source)
        {
            Assert.AreEqual("InstanceProperty", source);
        }

76. Example

Project: AutoTest.Net
Source File: AssemblyListTests.cs
View license
[Test]
        public void CanRemoveAssemblies()
        {
            assemblies.Add(path1);
            assemblies.Add(path2);
            assemblies.Add(path3);
            
            assemblies.Remove(path2);

            Assert.AreEqual(2, assemblies.Count);
            Assert.AreEqual(path1, assemblies[0]);
            Assert.AreEqual(path3, assemblies[1]);
        }

77. Example

View license
[Test]
        public void CanSpecifyDescription()
        {
			Test test = (Test)TestBuilder.MakeTestCase(
				typeof(TestCaseAttributeFixture), "MethodHasDescriptionSpecified").Tests[0];
			Assert.AreEqual("My Description", test.Description);
		}

78. Example

Project: AutoTest.Net
Source File: TestDomainFixture.cs
View license
[Test]
		public void BinPathOverrideIsHonored()
		{
			TestPackage package = new TestPackage( "MyProject.nunit" );
			package.Assemblies.Add( MockAssembly.AssemblyPath );
			package.PrivateBinPath = "dummy;junk";

			testDomain.Load( package );

			Assert.AreEqual( "dummy;junk", 
				testDomain.AppDomain.SetupInformation.PrivateBinPath );
		}

79. Example

View license
[Test]
			public void CanSetCultureOnFixture()
			{
				Assert.AreEqual( "en-GB", CultureInfo.CurrentCulture.Name );
			}

80. Example

View license
[Test]
		public void CanDeriveFromPropertyAttribute()
		{
			Test test3 = (Test)fixture.Tests[2];
			Assert.AreEqual( 5, test3.Properties["Priority"] );
		}

81. Example

View license
[Test]
		public void ChangingCurrentDirectoryGivesWarning()
		{
			TestResult result = TestBuilder.RunTestCase(typeof(DirectoryChangeFixture), "ChangeCurrentDirectory");
			Assert.AreEqual(ResultState.Success, result.ResultState);
			Assert.AreEqual("Warning: Test changed the CurrentDirectory", result.Message);
		}

82. Example

Project: AutoTest.Net
Source File: ProjectConfigTests.cs
View license
[Test]
		public void EmptyConfig()
		{
			Assert.AreEqual( "Debug", activeConfig.Name );
			Assert.AreEqual( 0, activeConfig.Assemblies.Count );
		}

83. Example

Project: AutoTest.Net
Source File: ValueSourceTests.cs
View license
[Test]
        public void ValueSourceCanBeStaticProperty(
            [ValueSource("StaticProperty")] string source)
        {
            Assert.AreEqual("StaticProperty", source);
        }

84. Example

View license
[Test]
		public void TestCaseCount()
		{
			Assert.AreEqual( totalTests , loadedSuite.TestCount);
		}

85. Example

View license
[Test]
        public void CanMangleSingleGeneric()
        {
            Assert.AreEqual("Foo`1<T>", GenericNameMangler.MangleParameterName("Foo<T>"));
        }

86. Example

Project: AutoTest.Net
Source File: NameFilterTest.cs
View license
[Test]
		public void ExplicitTestCaseDoesNotMatchWhenNotSelectedDirectly()
		{
			Test explicitTest = TestFinder.Find("ExplicitlyRunTest", testSuite, true);
			NameFilter filter = new NameFilter( testSuite.TestName );
			Assert.AreEqual( false, filter.Pass(explicitTest) );
		}

87. Example

Project: AutoTest.Net
Source File: TestNameTests.cs
View license
[Test]
		public void CanDisplayUniqueNames()
		{
			Assert.AreEqual( "[0]Name.Of.This.Test", weakName1.UniqueName );
			Assert.AreEqual( "[0-" + strongName1.TestID.ToString() + "]Name.Of.This.Test", strongName1.UniqueName );
		}

88. Example

Project: AutoTest.Net
Source File: MockTests.cs
View license
[Test]
		public void SetReturnValue()
		{
			mock.SetReturnValue( "myMethod", 5 );
			Assert.AreEqual( 5, mock.Call( "myMethod") );
			mock.Verify();
		}

89. Example

Project: AutoTest.Net
Source File: EqualsFixture.cs
View license
[Test, ExpectedException( typeof (AssertionException) )]
		public void DateTimeNotEqual()
		{
			DateTime dt1 = new DateTime( 2005, 6, 1, 7, 0, 0 );
			DateTime dt2 = new DateTime( 2005, 6, 1, 0, 0, 0 );
			expectedMessage =
				"  Expected: 2005-06-01 07:00:00.000" + Environment.NewLine +
				"  But was:  2005-06-01 00:00:00.000" + Environment.NewLine;
			Assert.AreEqual(dt1, dt2);
		}

90. Example

Project: AutoTest.Net
Source File: TestCaseSourceTests.cs
View license
[Test]
        public void IgnoreTakesPrecedenceOverExpectedException()
        {
            Test test = (Test)TestBuilder.MakeTestCase(
                typeof(TestCaseSourceAttributeFixture), "MethodCallsIgnore").Tests[0];
            TestResult result = test.Run(NullListener.NULL, TestFilter.Empty);
            Assert.AreEqual(ResultState.Ignored, result.ResultState);
            Assert.AreEqual("Ignore this", result.Message);
        }

91. Example

View license
[Test]
		public void SetResult_Ignore()
		{
			TestSuiteTreeNode node = new TestSuiteTreeNode( testCaseInfo );
			TestResult result = new TestResult( testCaseInfo );

			result.Ignore( "reason" );
			node.Result = result;
			Assert.AreEqual( "MockTest1", node.Result.Name );
			Assert.AreEqual( TestSuiteTreeNode.IgnoredIndex, node.ImageIndex );
			Assert.AreEqual( TestSuiteTreeNode.IgnoredIndex, node.SelectedImageIndex );
			Assert.AreEqual( "Ignored", node.StatusText );
		}

92. Example

View license
[Test]
        public void When_adding_key_and_value_with_equal_hash_verify_that_both_are_added()
        {
            Customer c1 = new Customer { Name = "a" };
            Customer c2 = new Customer { Name = "b" };

            _dict2.Add(c1, c1);
            _dict2.Add(c2, c2);

            Assert.AreEqual(2, _dict2.Count);
            Assert.AreEqual(c1, _dict2[c1]);
            Assert.AreEqual(c2, _dict2[c2]);
        }

93. Example

View license
[Test]
        public void When_adding_an_item_verify_that_the_item_count()
        {
            TestFixture t = new TestFixture(10);
            _dict[0] = t;
            Assert.AreEqual(1, _dict.Count);
        }

94. Example

View license
[Test]
        public void When_overwriting_an_existing_value_return_the_correct_value()
        {
            TestFixture t = new TestFixture(10);
            TestFixture t2 = new TestFixture(11);
            _dict[1] = t;
            _dict[1] = t2;
            TestFixture actual;
            _dict.TryGetValue(1, out actual);
            Assert.AreEqual(t2, actual);
        }

95. Example

View license
[Test]
        public void When_trying_to_get_an_existing_value_return_the_value()
        {
            TestFixture t = new TestFixture(10);
            _dict.Add(1, t);
            TestFixture actual;
            _dict.TryGetValue(1, out actual);
            Assert.AreEqual(t, actual);
        }

96. Example

View license
[Test]
        public void Length_and_count_returns_the_same_value()
        {
            Assert.AreEqual(0, _testList.Length);
            Assert.AreEqual(_testList.Count, _testList.Length);

            _testList.Add(2);

            Assert.AreEqual(1, _testList.Length);
            Assert.AreEqual(_testList.Count, _testList.Length);

            _testList.Remove(2);

            Assert.AreEqual(0, _testList.Length);
            Assert.AreEqual(_testList.Count, _testList.Length);
        }

97. Example

View license
[Test]
        public void When_adding_several_known_sized_items_verify_that_they_exist()
        {
            for (int i = 0; i < 100; i++)
            {
                _dict[i] = new TestFixture(i + 20);
            }

            for (int i = 0; i < 100; i++)
            {
                Assert.AreEqual(new TestFixture(i + 20), _dict[i]);
            }
        }

98. Example

View license
[Test]
        public void When_adding_two_key_objects_which_have_same_hash_verify_that_both_are_added()
        {
            Customer c1 = new Customer { Name = "a" };
            Customer c2 = new Customer { Name = "b" };

            _dict.Add(c1, 1);
            _dict.Add(c2, 2);

            Assert.AreEqual(2, _dict.Count);
            Assert.AreEqual(1, _dict[c1]);
            Assert.AreEqual(2, _dict[c2]);
        }

99. Example

View license
[Test]
        public void When_clearing_the_list_no_items_are_accessible()
        {
            _testList.Add(1);
            _testList.Add(2);
            Assert.AreEqual(2, _testList.Count);
            _testList.Clear();
            Assert.AreEqual(0, _testList.Count);

            MyAssert.ThrowsException<ArgumentOutOfRangeException>(() => { _testList[0] = 42; });
            MyAssert.ThrowsException<ArgumentOutOfRangeException>(() => { int a = _testList[0]; });
        }

100. Example

View license
[Test]
        public void When_inserting_an_item_existing_items_are_moved_and_list_is_increased_by_one()
        {
            _testList.Add(1);
            _testList.Add(2);
            Assert.AreEqual(2, _testList.Count);

            _testList.Insert(0, 0);
            Assert.AreEqual(0, _testList[0]);
            Assert.AreEqual(1, _testList[1]);
            Assert.AreEqual(2, _testList[2]);
            Assert.AreEqual(3, _testList.Count);
        }