Esempio n. 1
0
        public static void AppendMissing_BaseStringAlreadyEndsWithStringToAppend_ReturnsBaseString()
        {
            // Arrange
            const string Base1 = " ";
            const string Base2 = "     ";
            const string Base3 = "  \r\n ";
            const string Base4 = "here is some\r\nmore text ";
            const string Base5 = "http://www.microsoft.com/";

            // Act
            string actual1  = Base1.AppendMissing(" ");
            string actual2  = Base2.AppendMissing(" ");
            string actual3  = Base3.AppendMissing(" ");
            string actual4a = Base4.AppendMissing(" ");
            string actual4b = Base4.AppendMissing("more text ");
            string actual4c = Base4.AppendMissing("\r\nmore text ");
            string actual4d = Base4.AppendMissing("some\r\nmore text ");
            string actual5  = Base5.AppendMissing("/");

            // Assert
            Assert.Equal(Base1, actual1);
            Assert.Equal(Base2, actual2);
            Assert.Equal(Base3, actual3);
            Assert.Equal(Base4, actual4a);
            Assert.Equal(Base4, actual4b);
            Assert.Equal(Base4, actual4c);
            Assert.Equal(Base4, actual4d);
            Assert.Equal(Base5, actual5);
        }
Esempio n. 2
0
        public static void AppendMissing_BaseStringDoesNotEndWithStringToAppend_ReturnsBaseStringWithEndingStringAppended()
        {
            // Arrange
            const string Base1 = " ";
            const string Base2 = "     ";
            const string Base3 = "  \r\n  ";
            const string Base4 = "here is some\r\nmore text";
            const string Base5 = "http://www.microsoft.com";

            const string Append1  = ".";
            const string Append2  = "%sometext#";
            const string Append3a = "+_+";
            const string Append3b = "\r\n";
            const string Append4a = "y";
            const string Append4b = "/";
            const string Append5  = "/IMissVista-JustKidding";

            // Act
            string actual1  = Base1.AppendMissing(Append1);
            string actual2  = Base2.AppendMissing(Append2);
            string actual3a = Base3.AppendMissing(Append3a);
            string actual3b = Base3.AppendMissing(Append3b);
            string actual4a = Base4.AppendMissing(Append4a);
            string actual4b = Base4.AppendMissing(Append4b);
            string actual5  = Base5.AppendMissing(Append5);

            // Assert
            Assert.Equal(Base1 + Append1, actual1);
            Assert.Equal(Base2 + Append2, actual2);
            Assert.Equal(Base3 + Append3a, actual3a);
            Assert.Equal(Base3 + Append3b, actual3b);
            Assert.Equal(Base4 + Append4a, actual4a);
            Assert.Equal(Base4 + Append4b, actual4b);
            Assert.Equal(Base5 + Append5, actual5);
        }
Esempio n. 3
0
        public static void AppendMissing_StringToAppendIsEmpty_AlwaysReturnBaseString()
        {
            // Arrange
            string       base1 = string.Empty;
            const string Base2 = " ";
            const string Base3 = "   \r\n ";
            const string Base4 = "here is some\r\nmore text";

            // Act
            string actual1 = base1.AppendMissing(string.Empty);
            string actual2 = Base2.AppendMissing(string.Empty);
            string actual3 = Base3.AppendMissing(string.Empty);
            string actual4 = Base4.AppendMissing(string.Empty);

            // Assert
            Assert.Equal(base1, actual1);
            Assert.Equal(Base2, actual2);
            Assert.Equal(Base3, actual3);
            Assert.Equal(Base4, actual4);
        }