コード例 #1
0
        public async Task ReadSaleList_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await saleController.Get(new BaseApiController <Sale> .PaginationQuery
            {
                Limit = 2,
                Skip  = 0
            });

            HttpJsonApiResult <IEnumerable <SaleViewModel> > contentResult = result as HttpJsonApiResult <IEnumerable <SaleViewModel> >;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
コード例 #2
0
 private void LoadForm()
 {
     txtCustomerAddress.Text      = selectedCustomer.Address;
     txtCustomerEmail.Text        = selectedCustomer.Email;
     txtCustomerLastName.Text     = selectedCustomer.LastName;
     txtCustomerName.Text         = selectedCustomer.Name;
     txtCustomerNickName.Text     = selectedCustomer.NickName;
     txtCustomerPhone.Text        = selectedCustomer.Phone;
     this.newUser                 = false;
     btnCustomerErase.Enabled     = true;
     dgvCustomerQuotes.DataSource = quoteController.Get(selectedCustomer.Id.ToString());
     dgvCustomerSales.DataSource  = saleController.Get(selectedCustomer.Id.ToString());
 }
コード例 #3
0
        public async void Get_Not_Exists()
        {
            SaleControllerMockFacade mock = new SaleControllerMockFacade();

            mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiSaleServerResponseModel>(null));
            SaleController controller = new SaleController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Get(default(int));

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>()));
        }