Exemplo n.º 1
0
        public async Task CreateAsyncReturnsCarWhenRepositorySuccessfullyCreatesEntity()
        {
            // Arrange
            _vehicleRepositoryMock
            .Setup(r => r.CreateAsync(It.IsAny <Car>()))
            .ReturnsAsync((Car car) => car);

            var expected = new Car
            {
                Id             = Guid.NewGuid(),
                Type           = VehicleType.Car,
                Make           = "Toyota",
                Model          = "Yaris",
                NumberOfWheels = 4,
                NumberOfDoors  = 5,
                Engine         = "V4",
                BodyType       = CarBodyType.Hatchback
            };

            // Act
            var result = await _vehicleService.CreateAysnc(expected);

            // Assert
            Assert.Equal(expected, result);
        }