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

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

            sut.Checkout(24);

            mockLibraryAssetService.Verify(s => s.GetById(24), Times.Once());
        }
Ejemplo n.º 2
0
        public void Return_CheckOutModel()
        {
            var mockLibraryAssetService = new Mock <LibraryAssetService>();
            var mockCheckoutService     = new Mock <CheckoutService>();

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

            var result = sut.Checkout(24);

            var viewResult = result.Should().BeOfType <ViewResult>();

            viewResult.Subject.Model.Should().BeOfType <CheckoutModel>();
        }
Ejemplo n.º 3
0
        public void Return_CheckOut_View()
        {
            var mockLibraryAssetService = new Mock <ILibraryAssetService>();
            var mockCheckoutService     = new Mock <ICheckoutService>();

            mockLibraryAssetService.Setup(r => r.Get(24)).Returns(GetAsset());
            var sut = new CatalogController(mockLibraryAssetService.Object, mockCheckoutService.Object);

            var result = sut.Checkout(24);

            var viewResult = result.Should().BeOfType <ViewResult>();
            var viewModel  = viewResult.Subject.ViewData.Model.Should().BeAssignableTo <CheckoutModel>();

            viewModel.Subject.Title.Should().Be("Orlando");
        }
        public void Should_Call_GetById_In_ILibraryAsset_When_Checkout_Called()
        {
            //Arrange

            var mockLibraryAsset = new Mock <ILibraryAsset>();
            var mockCheckOut     = new Mock <ICheckOut>();

            mockLibraryAsset.Setup(x => x.GetById(23)).Returns(GetAsset());
            var catalog = new CatalogController(mockLibraryAsset.Object, mockCheckOut.Object);

            //Act
            catalog.Checkout(23);

            //Assert
            mockLibraryAsset.Verify(x => x.GetById(23), Times.Once());
        }
        public void Should_Return_CheckOutViewModel_When_CheckOut_Called()
        {
            //Arrange
            var mockLibraryAsset = new Mock <ILibraryAsset>();
            var mockCheckOut     = new Mock <ICheckOut>();

            mockLibraryAsset.Setup(x => x.GetById(23)).Returns(GetAsset());
            var catalog = new CatalogController(mockLibraryAsset.Object, mockCheckOut.Object);

            //Act
            var result = catalog.Checkout(23);

            //Assert
            var viewresult = result.Should().BeOfType <ViewResult>();
            var viewmodel  = viewresult.Subject.ViewData.Model.Should().BeAssignableTo <CheckoutViewModel>();

            viewmodel.Subject.AssetId.Should().Be(23);
            viewmodel.Subject.Title.Should().Be("Cameroon");
        }