public void OfficeRepository_AddOffice_Added_NotFail_Test() { var context = new MyCompanyContext(); int expected = context.Offices.Count() + 1; var target = new OfficeRepository(context); var officeId = context.Offices.Select(e => e.OfficeId).Max() + 1; var calendarId = context.Calendars.FirstOrDefault().CalendarId; var office = new Office() { OfficeId = officeId, CalendarId = calendarId }; target.Add(office); int actual = context.Offices.Count(); Assert.AreEqual(expected, actual); target.Delete(officeId); actual = context.Offices.Count(); Assert.AreEqual(expected - 1, actual); }
///<inheritdoc/> public override void Handle(BrokeredMessage message) { var officeRepository = new OfficeRepository(new MyCompanyContext()); officeRepository.Delete(message.GetBody <int>()); }