public async Task <IEnumerable <VehicleTypePropertyListModel> > ListVehicleTypeProperties(int vehicleTypeId)
        {
            vehicleTypeId = 1;

            List <VehicleTypePropertyListModel> propertyList = new List <VehicleTypePropertyListModel>();
            VehicleTypePropertyListModel        testProperty = new VehicleTypePropertyListModel();

            testProperty.VehicleTypePropertyId = 1;
            testProperty.VehicleTypeId         = 1;
            testProperty.VehiclePropertyId     = 1;
            testProperty.VehiclePropertyName   = "Engine";

            propertyList.Add(testProperty);

            return(propertyList);
        }
Ejemplo n.º 2
0
        public async void ValidInfo_ReturnsOkRequest()
        {
            // Arrange
            int vehicleTypeId = 1;

            var _vehicleTypePropertiesController = new VehicleTypePropertiesController(_loggerMock.Object, _mediatorMock.Object);

            List <VehicleTypePropertyListModel> propertyList = new List <VehicleTypePropertyListModel>();
            VehicleTypePropertyListModel        testProperty = new VehicleTypePropertyListModel();

            testProperty.VehicleTypePropertyId = 1;
            testProperty.VehicleTypeId         = 1;
            testProperty.VehiclePropertyId     = 1;
            testProperty.VehiclePropertyName   = "Engine";

            propertyList.Add(testProperty);


            var commandResult = new ListVehicleTypePropertyResult
            {
                StatusCode     = Convert.ToInt32(HttpStatusCode.OK),
                Message        = Convert.ToString(HttpStatusCode.OK),
                MessageDetails = "Vehicle type property list retrieve successful",
                VehicleTypePropertyListResults = propertyList
            };

            _mediatorMock.Setup(x => x.Send(It.IsAny <ListVehicleTypePropertyQuery>(), default(CancellationToken)))
            .Returns(Task.FromResult(commandResult));

            // Act
            var result = await _vehicleTypePropertiesController.GetVehicleTypeProperties(vehicleTypeId) as JsonResult;

            var response = result.Value as ListVehicleTypePropertyResponse;

            // Assert
            Assert.Equal(Convert.ToInt32(HttpStatusCode.OK), response.StatusCode);
            Assert.Equal(Convert.ToString(HttpStatusCode.OK), response.Message);
            Assert.Equal("Vehicle type property list retrieve successful", response.MessageDetail);
            Assert.NotNull(response.Payload.VehicleTypePropertyListResult);
        }