Beispiel #1
0
        public void Should_return_ok_result_with_count_equals_to_zero_when_no_devices_exist()
        {
            var parameters = new DevicesParametersModel();

            //Arrange
            _deviceApiService.Setup(x => x.GetDevicesCount(null, null, String.Empty)).Returns(0);

            //Act
            var result = _devicesController.GetDevicesCount(parameters).GetAwaiter().GetResult();

            //Assert
            Assert.IsInstanceOf <OkObjectResult>(result);

            var okObjectResult = result as OkObjectResult;

            Assert.NotNull(okObjectResult);

            Assert.IsInstanceOf <DevicesCountRootObject>(okObjectResult.Value);

            var rootObject = okObjectResult.Value as DevicesCountRootObject;

            Assert.NotNull(rootObject);

            rootObject.Count.ShouldEqual(0);
        }