Ejemplo n.º 1
0
        public async Task CreateAsyncShouldCreateRepairWithValidData()
        {
            //Arrange
            var RepairRepository = this.GetConfiguredRepairRepository(new List <Repair>());
            var carRepoaitory    = this.GetConfiguredCarRepository();
            var repairService    = new RepairService(RepairRepository.Object, carRepoaitory.Object);

            //Act
            var result = await repairService.CreateAsync(
                SampleCarId,
                SampleRepairDescription,
                SampleRepairHours,
                SampleRepairPricePerHour,
                SampleEmployeeId);

            //Arrange
            var newRepair = RepairRepository.Object.All();

            result
            .Should()
            .NotBeNull();

            newRepair
            .Count()
            .Should()
            .BePositive();

            newRepair
            .First()
            .Should()
            .Match <Repair>(repair => repair.Description == SampleRepairDescription)
            .And
            .Match <Repair>(repair => repair.Hours == SampleRepairHours)
            .And
            .Match <Repair>(repair => repair.PricePerHour == SampleRepairPricePerHour)
            .And
            .Match <Repair>(repair => repair.ServiceId == SampleCarServiceId);
        }