private void setDataForm(int id) { var productData = payment.GetPaymentType(id); if (productData == null) { Response.Redirect(Constants.Routes.PAYMENT_TYPE_ROUTE); return; } txttype.Attributes["Value"] = productData.Type.ToString(); txttypeold.Attributes["Value"] = productData.Type.ToString(); }
public async Task GetPaymentType_Returns_OkObjectResult() { //Arrange var id = 2; _fixture.MockPaymentTypeRepository.Setup(x => x.GetPaymentTypeAsync(It.IsAny <int>())) .ReturnsAsync(_fixture.PaymentTypes.Single(d => d.Id == id)); var controller = new PaymentTypeController(_fixture.MockPaymentTypeRepository.Object); //Act var result = await controller.GetPaymentType(id); //Assert var okResult = result.Should().BeOfType <OkObjectResult>().Subject; var paymentType = okResult.Value.Should().BeAssignableTo <GetPaymentTypeDto>().Subject; okResult.StatusCode.Should().Be(200); paymentType.Id.Should().Be(id); paymentType.Name.Should().Be("Credit"); paymentType.CreditPeriod.Should().Be(30); }