예제 #1
0
        public void TestTrueCustomMessage()
        {
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.True(false, "Custom message"));

            verifier.EqualOrDiff($"  Custom message{Environment.NewLine}  Expected: True{Environment.NewLine}  But was:  False{Environment.NewLine}", exception.Message);
        }
예제 #2
0
        public void TestLanguageIsSupportedMessageWithContext()
        {
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.LanguageIsSupported("NonLanguage"));

            verifier.EqualOrDiff($"  Context: Known Context{Environment.NewLine}Unsupported Language: 'NonLanguage'{Environment.NewLine}  Expected: False{Environment.NewLine}  But was:  True{Environment.NewLine}", exception.Message);
        }
예제 #3
0
        public void TestTrueMessageWithContext()
        {
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.True(false));

            verifier.EqualOrDiff($"  Context: Known Context{Environment.NewLine}{Environment.NewLine}  Expected: True{Environment.NewLine}  But was:  False{Environment.NewLine}", exception.Message);
        }
예제 #4
0
        public void TestFailCustomMessageWithContext()
        {
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.Fail("Custom message"));

            verifier.EqualOrDiff($"Context: Known Context{Environment.NewLine}Custom message", exception.Message);
        }
예제 #5
0
        public void TestFailCustomMessage()
        {
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.Fail("Custom message"));

            verifier.EqualOrDiff($"Custom message", exception.Message);
        }
예제 #6
0
        public void TestFailMessage()
        {
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.Fail());

            verifier.EqualOrDiff(string.Empty, exception.Message);
        }
예제 #7
0
        public void TestFalseMessage()
        {
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.False(true));

            verifier.EqualOrDiff($"  Expected: False{Environment.NewLine}  But was:  True{Environment.NewLine}", exception.Message);
        }
예제 #8
0
        public void TestEmptyMessageWithContext()
        {
            var actual    = new int[1];
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.Empty("someCollectionName", actual));

            verifier.EqualOrDiff($"  Context: Known Context{Environment.NewLine}Expected 'someCollectionName' to be empty, contains '1' elements{Environment.NewLine}  Expected: <empty>{Environment.NewLine}  But was:  < 0 >{Environment.NewLine}", exception.Message);
        }
예제 #9
0
        public void TestNotEmptyMessage()
        {
            var actual    = new int[0];
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.NotEmpty("someCollectionName", actual));

            verifier.EqualOrDiff($"  expected 'someCollectionName' to be non-empty, contains{Environment.NewLine}  Expected: not <empty>{Environment.NewLine}  But was:  <empty>{Environment.NewLine}", exception.Message);
        }
예제 #10
0
        public void TestEqualCustomMessageWithContext()
        {
            var expected  = 0;
            var actual    = 1;
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.Equal(expected, actual, "Custom message"));

            verifier.EqualOrDiff($"  Context: Known Context{Environment.NewLine}Custom message{Environment.NewLine}  Expected: 0{Environment.NewLine}  But was:  1{Environment.NewLine}", exception.Message);
        }
예제 #11
0
        public void TestEqualMessage()
        {
            var expected  = 0;
            var actual    = 1;
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.Equal(expected, actual));

            verifier.EqualOrDiff($"  Expected: 0{Environment.NewLine}  But was:  1{Environment.NewLine}", exception.Message);
        }
예제 #12
0
        public void TestSequenceEqualCustomMessageWithContext()
        {
            var expected  = new int[] { 0 };
            var actual    = new int[] { 1 };
            var verifier  = new NUnitVerifier().PushContext("Known Context");
            var exception = Assert.Throws <AssertionException>(() => verifier.SequenceEqual(expected, actual, message: "Custom message"));

            verifier.EqualOrDiff($"Context: Known Context{Environment.NewLine}Custom message", exception.Message);
        }
예제 #13
0
        public void TestSequenceEqualCustomMessage()
        {
            var expected  = new int[] { 0 };
            var actual    = new int[] { 1 };
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.SequenceEqual(expected, actual, message: "Custom message"));

            verifier.EqualOrDiff($"Custom message", exception.Message);
        }
예제 #14
0
        public void TestSequenceEqualMessage()
        {
            var expected  = new int[] { 0 };
            var actual    = new int[] { 1 };
            var verifier  = new NUnitVerifier();
            var exception = Assert.Throws <AssertionException>(() => verifier.SequenceEqual(expected, actual));

            verifier.EqualOrDiff(string.Empty, exception.Message);
        }