コード例 #1
0
        public void Generate_When_Called_Sends_CultureInfo_To_AddSpecificMessagePart_Method()
        {
            // Arrange
            TestAssertionMessageSubclass testAssertionMessageSubclass = new TestAssertionMessageSubclass(null, null);
            var cultureInfo = new Mock <CultureInfo>("en-ZW").Object;

            // Act
            var resString = testAssertionMessageSubclass.Generate(cultureInfo);

            // Assert
            Assert.AreEqual(cultureInfo, testAssertionMessageSubclass.CultureInfoReceivedInMethod);
        }
コード例 #2
0
        public void Generate_When_Called_Given_That_Description_Is_Null_Creates_Resulted_Message_Correctly()
        {
            // Arrange
            var stringToAdd = $"String line1";
            TestAssertionMessageSubclass testAssertionMessageSubclass = new TestAssertionMessageSubclass(null as string, stringToAdd);

            // Act
            var resString = testAssertionMessageSubclass.Generate(CultureInfo.InvariantCulture);

            // Assert
            var expectedString = @$ "
--------
Assertion failed.
{stringToAdd}
--------";

            Assert.AreEqual(expectedString, resString);
        }
コード例 #3
0
        public void Generate_When_Called_Creates_Resulted_Message_Correctly()
        {
            // Arrange
            var descr       = "some description";
            var stringToAdd = $"String line1{Environment.NewLine}String line2";
            TestAssertionMessageSubclass testAssertionMessageSubclass = new TestAssertionMessageSubclass(descr, stringToAdd);

            // Act
            var resString = testAssertionMessageSubclass.Generate(CultureInfo.InvariantCulture);

            // Assert
            var expectedString = @$ "
--------
Assertion failed.
{stringToAdd}
{descr}
--------";

            Assert.AreEqual(expectedString, resString);
        }