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);
        }
        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));
            }
        }
        public void Rewriter_calls_to_testframework_autorewriting()
        {
            var printer = TestHelper.CreateTestPrinter();

            var fakeReadContent = new System.Text.UTF8Encoding(true).GetBytes(TestFileContent);
            var mock = new FileRepositoryMock(fakeReadContent);
            printer.Configuration.FactoryFileRepository = () => mock;
            printer.Configuration.Test.SetAutomaticTestRewrite(x => true);

            var assertMock = new AreEqualsMethodMock();
            printer.Configuration.Test.SetAreEqualsMethod(assertMock.AreEqualsMock);

            string expected = "boo";
            printer.Assert.AreAlike(expected, "actul");

            Assert.AreEqual("boo", assertMock.Expected);
            Assert.AreEqual("actul", assertMock.Actual);
            Assert.IsTrue(assertMock.Message.StartsWith("Rewritting test expectations in '"));
            Assert.IsTrue(assertMock.Message.EndsWith(@"'.
            Compile and re-run to see green lights.
            New expectations:
            ""actul"""));
            Assert.IsTrue(mock.WritePath.EndsWith("ReWriterMockedTests.cs"));
        }
        public void Rewriter_calls_to_testframework_fileTooShort()
        {
            var printer = TestHelper.CreateTestPrinter();

            var fakeReadContent = new System.Text.UTF8Encoding(true).GetBytes(TestFileContent);
            printer.Configuration.FactoryFileRepository = () => new FileRepositoryMock(fakeReadContent);
            printer.Configuration.Test.SetAutomaticTestRewrite((x) => true);

            var assertMock = new AreEqualsMethodMock();
            printer.Configuration.Test.SetAreEqualsMethod(assertMock.AreEqualsMock);

            string expected = @"expect";

            printer.Assert.AreAlike(expected, "actul");
        }
        public void AreEquals_WhenValues_AreAlike_Then_Suggest_change()
        {
            var assertMock = new AreEqualsMethodMock();
            Asserter assert = TestHelper.Assert();
            assert.Configuration.Test.SetAreEqualsMethod(assertMock.AreEqualsMock);

            foreach (Tuple t in alikeStrings)
            {
                assert.AreEqual(t.Item1, t.Item2);
                Assert.IsTrue(assertMock.Message.StartsWith(AreAlikeNotice));
            }
        }