public void GetAll_Should_Return_As_200OKResult() { //Arrange _mediator.Setup(s => s.Send(It.IsAny <GetAllCustomersQuery>(), default)).Returns(Task.FromResult(_customerDataListResponse.Object)); _customerDataListResponse.Setup(t => t.Success).Returns(true); _customerDataListResponse.Setup(t => t.StatusCode).Returns(StatusCodes.Status200OK); _customerDataListResponse.Setup(s => s.Data).Returns(_customerListResponse.Object); //Act var actual = _sut.GetAllCustomers().GetAwaiter().GetResult(); //Assert actual.GetType().Should().Equals(StatusCodes.Status200OK); }
public void GetAllCustomersShouldReturnOk() { var data = GetCustomerList(); _customerService.Setup(x => x.GetAll()).Returns(data); var response = _customersController.GetAllCustomers(); var result = Assert.IsType <OkObjectResult>(response); Assert.Equal(200, result.StatusCode); Assert.NotNull(result.Value); var responseData = Assert.IsType <List <Customer> >(result.Value); Assert.NotEmpty(responseData); }
public void GetAllCustomers_ReturnsOK() { var controller = new CustomersController(customersManipulation); // Act var result = controller.GetAllCustomers(); // Assert Assert.IsType <OkObjectResult>(result); }
public void ShouldSuccessfullyReturnCustomerList() { // arrange var mockCustomers = new List <Customer>() { new Customer() { FirstName = "first-name", LastName = "last-name" } }; _customerRepo.GetCustomers() .Returns(mockCustomers); // act var actionResult = _customersController.GetAllCustomers(); // assert Assert.IsType <OkObjectResult>(actionResult.Result); }
protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridFilteringItem) { GridFilteringItem filterItem = (GridFilteringItem)e.Item; RadDropDownList ctflist = (RadDropDownList)filterItem.FindControl("ddlCustomerFilter"); try { CustomersController ctcont = new CustomersController(); ctflist.DataSource = ctcont.GetAllCustomers(); ctflist.DataTextField = "NameGR"; ctflist.DataValueField = "ID"; ctflist.DataBind(); ctflist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0")); } catch (Exception) { } } }
public void TestGetAllCount() { Assert.AreEqual(3, controller.GetAllCustomers().Count); }
public async Task GetAllCustomers_Returns_Data() { var result = await controller.GetAllCustomers(); Assert.IsTrue(result.Value.Count > 0, "There is no data in db"); }
public void GetAllCustomers_ReturnsOK() { var okResult = _controller.GetAllCustomers(); Assert.IsType <OkObjectResult>(okResult.Result); }