public async void Authorize_WhenModelInvalid_ShouldReturnToSaleView( SaleController sut, SaleViewModel model) { sut.ModelState.AddModelError("teste", "deu ruim"); var act = await sut.Authorize(model); var viewResult = act as ViewResult; viewResult.ShouldNotBeNull(); viewResult.Model.ShouldNotBeNull(); viewResult.Model.ShouldBeEqualTo(model); viewResult.ViewName.ShouldBeEqualTo("SaleProduct"); }
public async void Authorize_WhenTypeSendSoap_ShouldReturResponseRequest( SaleController sut, SaleViewModel model, ResponseViewModel response) { model.TypeSend = TypeSendEnum.SOAP; sut.SoapRequestService.AuthorizeTransaction(model, Arg.Any <string>()).Returns(response); var act = await sut.Authorize(model); var viewResult = act as ViewResult; viewResult.ShouldNotBeNull(); viewResult.ViewName.ShouldBeEqualTo("Index"); viewResult.Model.ShouldNotBeNull(); (viewResult.Model as ResponseViewModel).TypeSend.ShouldBeEqualTo(TypeSendEnum.REST); await sut.SoapRequestService.Received().AuthorizeTransaction(model, Arg.Any <string>()); }