Ejemplo n.º 1
0
        public async Task Update_NotNull_ViewResultIsNotNull()
        {
            //Arrange
            var wallet = new WalletViewModel()
            {
                Id          = 1,
                Description = "for shopping",
            };
            var mockPerson = new Mock <IPersonWebService>();
            var mockWallet = new Mock <IWalletWebService>();
            var controller = new WalletController(mockWallet.Object, mockPerson.Object);

            //Act
            var result = await controller.Update(wallet.Id, wallet);

            //Assert
            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public async Task Update_ReturnsRedirect_ToActionResut()
        {
            // Arrange
            var walletId = 1;
            var wallet   = new WalletViewModel()
            {
                Id = walletId
            };
            var mockPerson = new Mock <IPersonWebService>();
            var mockWallet = new Mock <IWalletWebService>();
            var controller = new WalletController(mockWallet.Object, mockPerson.Object);

            mockWallet.Setup(p => p.Update(walletId, It.IsAny <WalletViewModel>()));

            // Act
            var result = await controller.Update(walletId, wallet);

            // Assert
            var redirectToActionResult = result as RedirectToActionResult;

            Assert.AreEqual("Details", redirectToActionResult.ActionName);
        }