Exemplo n.º 1
0
        public void fastAssertSingleReplacementDiffEnsuresOldHaystackDoesNotContainNeedle()
        {
            const string OLD_HAYSTACK = "abc";
            const string NEW_HAYSTACK = "abcd";
            const string NEEDLE       = "b";

            Assert.Throws <DoesNotContainException>(() => FastAssert.fastAssertSingleReplacementDiff(OLD_HAYSTACK, NEW_HAYSTACK, NEEDLE));
        }
Exemplo n.º 2
0
        public void fastAssertSingleReplacementDiffDoesNotThrowWhenNeedleIsFound()
        {
            const string OLD_HAYSTACK = "abc";
            const string NEW_HAYSTACK = "adc";
            const string NEEDLE       = "d";

            FastAssert.fastAssertSingleReplacementDiff(OLD_HAYSTACK, NEW_HAYSTACK, NEEDLE);
        }
Exemplo n.º 3
0
        public void fastAssertSingleReplacementDiffEnsuresOldAndNewHaystacksAreDifferent()
        {
            const string OLD_HAYSTACK = "abc";
            const string NEW_HAYSTACK = "abc";
            const string NEEDLE       = "d";

            Assert.Throws <FalseException>(() => FastAssert.fastAssertSingleReplacementDiff(OLD_HAYSTACK, NEW_HAYSTACK, NEEDLE));
        }
Exemplo n.º 4
0
        public void fastAssertSingleReplacementDiffShowsDiffWhenNeedleIsNotFound()
        {
            const string OLD_HAYSTACK = "abc";
            const string NEW_HAYSTACK = "adc";
            const string NEEDLE       = "e";

            try {
                FastAssert.fastAssertSingleReplacementDiff(OLD_HAYSTACK, NEW_HAYSTACK, NEEDLE);
                Assert.False(true, "should have thrown a ContainsException above");
            } catch (XunitException e) {
                Assert.Equal("Not found:\ne\n\nIn actual. Diff between original and actual:\nadc", e.Message);
            }
        }