public PalindromesControllerTests()
        {
            var options = new DbContextOptionsBuilder <PalindromeContext>()
                          .UseInMemoryDatabase(databaseName: "Palindromes")
                          .Options;

            palindromeFactory = new PalindromeFactory();
            context           = new PalindromeContext(options);
            controller        = new PalindromesController(context, palindromeFactory);
        }
        public void TestPalindromeString()
        {
            var factory = new PalindromeFactory();
            // Populate new palindrome string
            var result = factory.PopulatePalindromeString(7, 8, 10);

            //Check if the result is not null
            Assert.IsNotNull(result);

            //Check if each string is a palindrome
            foreach (var palindromeString in result.PalindromeList)
            {
                var reversed = HelperClass.Reverse(palindromeString.PalindromeString);

                Assert.IsTrue(palindromeString.PalindromeString == reversed);
            }
        }
 public void Dispose()
 {
     controller        = null;
     context           = null;
     palindromeFactory = null;
 }
Esempio n. 4
0
 public PalindromeFactoryTest()
 {
     factory = new PalindromeFactory(new List<IPalindromeStrategy> { new RecursivePalindromeStrategy(), new ReversingPalindromeStrategy() });
 }