Esempio n. 1
0
        public async Task Delete_BadIdPassed_ProperFunctionsCalled()
        {
            var id = Guid.NewGuid();

            var audioBooksService = new Mock<IAudioBookServiceAsync>();

            var apiController = new AudioBookManualController(audioBooksService.Object);
            audioBooksService.Setup(x => x.Delete(It.IsAny<Guid>())).Throws(new InvalidOperationException());

            await Assert.ThrowsAsync<InvalidOperationException>(() => apiController.DeleteConfirmed(id));
        }
Esempio n. 2
0
        public async Task Delete_GoodIdPassed_ProperFunctionsCalled()
        {
            var id = Guid.NewGuid();

            var audioBooksService = new Mock <IAudioBookServiceAsync>();

            var apiController = new AudioBookManualController(audioBooksService.Object);

            await apiController.DeleteConfirmed(id);

            audioBooksService.Verify(x => x.Delete(It.Is <Guid>(guid => guid == id)));
        }