コード例 #1
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
        public void AssertsValues_SpecifyInvalidData_ThrowsAsertionException()
        {
            var catchCounter = 0;

            try { ContractAssert.IsNull(new object(), "Some message"); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }

            try { ContractAssert.IsNotNull(null, "Some message"); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }

            try { ContractAssert.IsTrue(false, "Some message"); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }

            try { ContractAssert.IsFalse(true, "Some message"); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }

            try { ContractAssert.Fail("Test error message for assertion."); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }
            try { ContractAssert.OfType <DateTime>(new object()); }
            catch (ContractException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("---");
                catchCounter++;
            }

            NUnitAssert.AreEqual(catchCounter, 6, "All the assertion should throw exception");
        }
コード例 #2
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsTrue_SpecifyInvalidData_ThrowsAsertionException()
 {
     ContractAssert.IsTrue(false);
 }
コード例 #3
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsTrue_SpecifyValidData_Valid()
 {
     ContractAssert.IsTrue(true);
 }
コード例 #4
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsNull_SpecifyValidData_Valid()
 {
     ContractAssert.IsNull(null);
 }
コード例 #5
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsNotNull_SpecifyValidData_Valid()
 {
     ContractAssert.IsNotNull(new object());
 }
コード例 #6
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsNotNull_SpecifyNull_ThrowsAsertionException()
 {
     ContractAssert.IsNotNull(null);
 }
コード例 #7
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertIsNotNull_SpecifyInvalidData_ThrowsAsertionException()
 {
     ContractAssert.IsNull(new object());
 }
コード例 #8
0
ファイル: TestAssertions.cs プロジェクト: thabet-fix/ndoctor
 public void AssertBoolean_SpecifyValidData_Valid()
 {
     ContractAssert.IsFalse(false);
 }