public async void CreateReservation( EStatusCode expectedStatus, CreateReservation mutation ) { if (expectedStatus != EStatusCode.NotFound) { EntitiesFactory.NewAnnouncement(id: mutation.AnnouncementId).Save(); } if (expectedStatus == EStatusCode.Conflict) { EntitiesFactory.NewContact(phone: mutation.ContactPhone).Save(); } var result = await MutationsHandler.Handle(mutation); Assert.Equal(expectedStatus, result.Status); if (expectedStatus == EStatusCode.Success) { var reservationDb = await MutationsDbContext.Reservations .Where(r => r.Id == mutation.Id) .FirstOrDefaultAsync(); Assert.NotNull(reservationDb); Assert.Equal(mutation.AnnouncementId, reservationDb.AnnouncementId); Assert.Equal(mutation.ContactName, reservationDb.Contact.Name); Assert.Equal(mutation.ContactPhone, reservationDb.Contact.Phone); } }