public void Update_Existing_Repair()
        {
            var repairContextMock = new Mock <DB.Interface.IDatabaseService>();

            repairContextMock.Setup(x => x.Repairs).Returns(repairsMock.Object);
            repairContextMock.Setup(x => x.Cars).Returns(carsMock.Object);
            repairContextMock.Setup(x => x.RepairNotes).Returns(emptyRepairNotesMock.Object);

            var repairService = new RepairService(repairContextMock.Object);

            repairService.UpdateRepair(new BL.Repair.DTO.RepairDTO
            {
                Id    = 1,
                CarId = 2,
                Date  = DateTime.Parse("10.08.2018 15:53:00"),
                Name  = "Olejek",
                Notes = new List <RepairNoteDTO> {
                    new RepairNoteDTO {
                        Description = "Uzyto oleju 5W40 Valvoline"
                    }
                }
            });
            try
            {
                // repairsMock.Verify(m => m.Add(It.IsAny<Repair>()), Times.AtLeastOnce());
                repairContextMock.Verify(m => m.Save(), Times.AtLeastOnce());
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Assert.IsTrue(false);
            }
        }
Beispiel #2
0
        public void UpdateRepair([FromBody] RepairViewModel model)
        {
            RepairService repairService = new RepairService();

            repairService.UpdateRepair(model);
        }