Ejemplo n.º 1
0
        public async Task Should_Get_A_List_Of_Devices()
        {
            var controller = new DevicesController(fixture.GetDataProvider());
            var response   = await controller.GetDevices() as OkObjectResult;

            Assert.NotNull(response.Value);
            Assert.Equal(response.StatusCode, (int)HttpStatusCode.OK);
        }
        public async Task GetDevices_ShouldReturnNotNull()
        {
            PagingParams pagingParams = new PagingParams()
            {
                PageSize = 2
            };

            var result = await _devicesController.GetDevices(pagingParams);

            Assert.NotNull(result);
        }
Ejemplo n.º 3
0
        public void Should_call_service_with_same_parameters_when_valid_parameters_passed()
        {
            //Arrange
            var returnedDevicesList = new List <Device>();
            var parameters          = new DevicesParametersModel
            {
                SinceId      = Configurations.DefaultSinceId + 1, // some different than default since id
                CreatedAtMin = DateTime.Now,
                CreatedAtMax = DateTime.Now,
                Page         = Configurations.DefaultPageValue + 1, // some different than default page
                Limit        = Configurations.MinLimit + 1,         // some different than default limit
            };

            _deviceApiService.Setup(x => x.GetDevices(null, parameters.Limit, parameters.Page, parameters.SinceId,
                                                      parameters.CreatedAtMin, parameters.CreatedAtMax, string.Empty)).Returns(returnedDevicesList);

            //Act
            _devicesController.GetDevices(parameters).GetAwaiter().GetResult();

            //Assert
            _deviceApiService.Verify(x => x.GetDevices(null, parameters.Limit, parameters.Page, parameters.SinceId,
                                                       parameters.CreatedAtMin, parameters.CreatedAtMax, string.Empty));
        }