public GivenWhenSequenceIsValidPalindrome()
            {
                _mockPalindromeService = new Mock <IPalindromeService>();
                _mockPalindromeService.Setup(svc => svc.SaveAsync(It.IsAny <CreatePalindromeModel>())).ReturnsAsync(_svcResponse);

                _mockMapper = new Mock <IMapper>();

                // Mock controller request to Service Model
                _mockMapper.Setup(m => m.Map <CreatePalindromeModel>(It.IsAny <CheckPalindromeRequest>())).Returns((CheckPalindromeRequest request) =>
                {
                    return(new CreatePalindromeModel()
                    {
                        Sequence = request.Sequence
                    });
                });

                // Mock Service Model to Controller Response
                _mockMapper.Setup(m => m.Map <PalindromeResponse>(It.IsAny <PalindromeModel>())).Returns((PalindromeModel model) =>
                {
                    return(new PalindromeResponse()
                    {
                        Id = model.Id,
                        Sequence = model.Sequence,
                        CreateDate = model.CreateDate
                    });
                });


                _controller = new PalindromesController(_mockPalindromeService.Object, _mockMapper.Object);
            }
            public GivenWhenSequenceIsNotPalindrome()
            {
                _mockPalindromeService = new Mock <IPalindromeService>();
                _mockMapper            = new Mock <IMapper>();

                _controller = new PalindromesController(_mockPalindromeService.Object, _mockMapper.Object);
            }
        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 Dispose()
 {
     controller        = null;
     context           = null;
     palindromeFactory = null;
 }