Exemplo n.º 1
0
        public void MakeUppercase(string value, string expectedResult)
        {
            // Arrange
            StringSolver stringSolver = new StringSolver();

            // Act
            string actualResult = stringSolver.MakeUppercase(value);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 2
0
        public void AreEqualIgnoreCase(string value1, string value2, bool expectedResult)
        {
            // Arrange
            StringSolver stringSolver = new StringSolver();

            // Act
            bool actualResult = stringSolver.AreEqualIgnoreCase(value1, value2);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 3
0
        public void FullName(string firstName, string lastName, string expectedResult)
        {
            // Arrange
            StringSolver stringSolver = new StringSolver();

            // Act
            string actualResult = stringSolver.FullName(firstName, lastName);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 4
0
 public void RemoveDuplicateCharsTest()
 {
     //arrange
     var solver = new StringSolver();
     var tests = new List<string>()
     {
         "a",
         "aa",
         "aba",
         "123",
         "1221"
     };
     
     foreach (string test in tests)
     {
         var actual = solver.RemoveDuplicateChars(test);
         Assert.AreEqual(test.Distinct().Count(), actual.Count());
     }
 }
Exemplo n.º 5
0
        public void HasUniqueCharactersTest()
        {
            //arrange
            var solver = new StringSolver();
            var testDict = new Dictionary<string, bool>
            {
                {"a", true},
                {"ab", true},
                {"a1", true },
                {"12", true },
                {"aa",  false},
                {"Aa", true },
                {"11", false },
                {"AA", false }
            };

            foreach (KeyValuePair<string, bool> test in testDict)
            {
                var actual = solver.HasUniqueCharacters(test.Key);
                var expected = test.Value;
                Assert.AreEqual(expected, actual);
            }

        }