public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Spell validSpellResult = new Spell();

            spellServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validSpellResult));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            var result = await SUT.Details(validId) as ViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(SpellDetailsViewModel));
        }
        public async Task CallFindAsync_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Spell validSpellResult = new Spell();

            spellServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validSpellResult));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Details(validId);

            // Assert
            spellServiceMock.Verify(mock => mock.FindAsync(validId), Times.Once);
        }
        public void Spells()
        {
            SpellController controller = new SpellController();

            var x = controller.Details(1);

            Assert.IsNotNull(x);
        }
        public async Task ThrowApplicationException_WhenPassedSpellIsNull()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Spell invalidSpellResult = null;

            spellServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(invalidSpellResult));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act & Assert
            await Assert.ThrowsExceptionAsync <ApplicationException>(() =>
                                                                     SUT.Details(validId));
        }