public void AddCalendarEvent_AddingEventWithExistingId_ShouldThrowException() { // Arrange Event @event = GetTestEvent(1); var eventRepository = new EventRepository(_context); // Act and Assert Assert.Throws <ArgumentException>(() => eventRepository.AddCalendarEvent(@event)); }
public void AddCalendarEvent_AddingEvent_ShouldAddEventToDB() { // Arrange Event @event = GetTestEvent(1); @event.Id = default; var eventRepository = new EventRepository(_context); // Act eventRepository.AddCalendarEvent(@event); // Assert Assert.Equal(_context.Events.Find(@event.Id), @event); }