コード例 #1
0
        public void StrStrNoFindTest(string haystack, string needle)
        {
            //Arrange
            int         expected = -1;
            Solution028 s        = new Solution028();

            //Act
            int actual = s.StrStr(haystack, needle);

            //Assert
            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void StrStrFindTest4()
        {
            //Arrange
            int         expected = 6;
            Solution028 s        = new Solution028();

            //Act
            int actual = s.StrStr("mississippi", "sipp");

            //Assert
            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void StrStrFindTest()
        {
            //Arrange
            int         expected = 2;
            Solution028 s        = new Solution028();

            //Act
            int actual = s.StrStr("hello", "ll");

            //Assert
            Assert.Equal(expected, actual);
        }
コード例 #4
0
        public void StrStrFindTest2()
        {
            //Arrange
            int         expected = 0;
            Solution028 s        = new Solution028();

            //Act
            int actual = s.StrStr("a", "a");

            //Assert
            Assert.Equal(expected, actual);
        }
コード例 #5
0
 public void TestMethod(string haystack, string needle, int output)
 {
     Assert.Equal(output, Solution028.StrStr(haystack, needle));
 }