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

            palindromeFactory = new PalindromeFactory();
            context           = new PalindromeContext(options);
            controller        = new PalindromesController(context, palindromeFactory);
        }
        public static void Initialize(PalindromeContext context)
        {
            context.Database.EnsureCreated();

            if (context.Palindromes.Any())
            {
                return;
            }

            context.Palindromes.Add(new Models.Palindrome {
                Value = "abba"
            });

            context.SaveChanges();
        }
 public PalindromeController(IPalindromeChecker palindromeChecker, PalindromeContext palindromeContext)
 {
     _palindromeChecker = palindromeChecker;
     _palindromeContext = palindromeContext;
 }
Exemple #4
0
 public PalindromeDataRepository(PalindromeContext context)
 {
     _context = context;
 }
Exemple #5
0
 public HealthCheck(ILogger <HealthCheck> logger, PalindromeContext context) : base(logger)
 {
     _logger  = logger;
     _context = context;
 }
 public void Dispose()
 {
     controller        = null;
     context           = null;
     palindromeFactory = null;
 }
 public PalindromesController(PalindromeContext context, IPalindromeFactory palindromeFactory)
 {
     _context           = context;
     _palindromeFactory = palindromeFactory;
 }