Example #1
0
        public void AreEquals_Escaping_To_Csharp_format_when_required()
        {
            var      assertMock = new AreEqualsMethodMock();
            Asserter assert     = TestHelper.Assert();

            assert.Configuration.Test.SetAreEqualsMethod(assertMock.AreEqualsMock);

            // without "
            assert.AreEqual("a", "b");
            Assert.AreEqual("a", assertMock.Expected);
            Assert.AreEqual("b", assertMock.Actual);
            Assert.AreEqual("\r\n\r\nProposed output for unit test:\r\n\r\nvar expected = \"b\";\r\n", assertMock.Message);

            // with  "
            assert.AreEqual("c", "\"e\"");
            Assert.AreEqual("c", assertMock.Expected);
            Assert.AreEqual("\"e\"", assertMock.Actual);
            Assert.AreEqual("\r\n\r\nProposed output for unit test:\r\n\r\nvar expected = @\"\"\"e\"\"\";\r\n", assertMock.Message);


            // without "
            assert.That("aa", Is.EqualTo("bb"));
            Assert.AreEqual("bb", assertMock.Expected);
            Assert.AreEqual("aa", assertMock.Actual);
            Assert.AreEqual("\r\n\r\nProposed output for unit test:\r\n\r\nvar expected = \"aa\";\r\n", assertMock.Message);


            // with  "
            assert.That("\"cc\"", Is.EqualTo("ee"));
            Assert.AreEqual("ee", assertMock.Expected);
            Assert.AreEqual("\"cc\"", assertMock.Actual);
            Assert.AreEqual("\r\n\r\nProposed output for unit test:\r\n\r\nvar expected = @\"\"\"cc\"\"\";\r\n", assertMock.Message);
        }
Example #2
0
        public void AreAlike()
        {
            var      assertMock = new AreEqualsMethodMock();
            Asserter assert     = TestHelper.Assert();

            assert.Configuration.Test.SetAreEqualsMethod(assertMock.AreEqualsMock);

            foreach (Tuple t in alikeStrings)
            {
                assert.AreAlike(t.Item1, t.Item2);
                assert.That(t.Item1, Is.AlikeTo(t.Item2));
            }
        }
Example #3
0
        public void That_WhenNotConfigured()
        {
            var printer = new Stateprinter();
            var ex      = Assert.Throws <ArgumentNullException>(() => printer.Assert.That("a", Is.EqualTo("b")));

            Assert.AreEqual(ExpectedNonconfigured, ex.Message);
        }