public void DoWork_handles_ChangedData() { RacconHistory spiedHistory = null; var mockLogger = new Mock <ILogger>(); var historyRepository = new Mock <IHistoryRepository>(); historyRepository .Setup(h => h.InsertHistory(It.IsAny <RacconHistory>()) ) .Callback <RacconHistory>((h) => { spiedHistory = h; } ) .Returns(1); var sut = new RaceService(mockLogger.Object, historyRepository.Object); var job = new Job { Entity = eWiftEntity.Meeting, ChangeProperty = "StartTime", ChangeData = new DateTime(2019, 11, 24, 14, 35, 0), SubjectName = "Test Race 1", RaceId = Guid.Parse("C56A4180-65AA-42EC-A945-5FD21DEC0538") }; sut.DoWork(job); Assert.AreEqual("success", spiedHistory.status); Assert.AreEqual("Test Race 1", spiedHistory.subjectname); Assert.AreEqual("C56A4180-65AA-42EC-A945-5FD21DEC0538", spiedHistory.subjectkey.ToString().ToUpper()); dynamic dyn = JsonConvert.DeserializeObject(spiedHistory.data); Assert.AreEqual("2019-11-24T14:35:00Z", dyn.postTime.ToString("yyyy-MM-ddTHH:mm:ssZ")); }