Exemplo n.º 1
0
        public void Call_CheckInItem_In_Service_When_CheckIn_Called()
        {
            var mockLibraryAssetService = new Mock <LibraryAssetService>();
            var mockCheckoutService     = new Mock <CheckoutService>();

            mockLibraryAssetService.Setup(r => r.GetById(24)).Returns(GetByIdAsset());
            var controller = new CatalogController(mockLibraryAssetService.Object, mockCheckoutService.Object);

            controller.CheckIn(24);

            mockCheckoutService.Verify(s => s.CheckInItem(24), Times.Once());
        }
        public void Should_Call_CheckInItem_In_ICheckOut_When_CheckIn_Called()
        {
            var mockLibraryAssetService = new Mock <ILibraryAsset>();
            var mockCheckoutService     = new Mock <ICheckOut>();

            mockLibraryAssetService.Setup(r => r.GetById(23)).Returns(GetAsset());
            var controller = new CatalogController(mockLibraryAssetService.Object, mockCheckoutService.Object);

            var result = controller.CheckIn(23);

            mockCheckoutService.Verify(x => x.CheckInItem(23), Times.Once());
        }
Exemplo n.º 3
0
        public void Return_DetailView_When_CheckIn_Called()
        {
            var mockLibraryAssetService = new Mock <LibraryAssetService>();
            var mockCheckoutService     = new Mock <CheckoutService>();

            mockLibraryAssetService.Setup(r => r.GetById(24)).Returns(GetByIdAsset());
            var controller = new CatalogController(mockLibraryAssetService.Object, mockCheckoutService.Object);

            var result         = controller.CheckIn(24);
            var redirectResult = result.Should().BeOfType <RedirectToActionResult>();

            redirectResult.Subject.ActionName.Should().Be("Detail");
        }