예제 #1
0
        public void TestCreateRepair()
        {
            //Arrange
            var testCar    = TestConstants.GetTestCar();
            var testUser   = TestConstants.GetTestUser();
            var testRepair = TestConstants.GetTestRepair();

            testCar.User   = testUser;
            testUser.Car   = testCar;
            testCar.Repair = testRepair;
            testRepair.Car = testCar;
            var repairDto = _mapper.Map <RepairDto>(testRepair);
            //Act
            var repairDtoResult   = _repairService.Save(repairDto);
            var repairDtoDbResult =
                _carMechanicContext.Repairs.SingleOrDefault(x => x.Guid == Guid.Parse(repairDto.RepairGuid));

            //Assert
            Assert.IsNotNull(repairDtoResult);
            Assert.IsNotNull(repairDtoDbResult);
            Assert.AreEqual(repairDtoDbResult
                            .Guid, Guid.Parse(repairDtoResult.RepairGuid));
        }