public When_OpportunityItemRepository_Update_Is_Called() { var logger = Substitute.For <ILogger <GenericRepository <Domain.Models.OpportunityItem> > >(); using var dbContext = InMemoryDbContext.Create(); var entity = new ValidOpportunityItemBuilder().Build(); dbContext.Add(entity); dbContext.SaveChanges(); var repository = new GenericRepository <Domain.Models.OpportunityItem>(logger, dbContext); entity.RouteId = 2; entity.OpportunityType = OpportunityType.ProvisionGap.ToString(); entity.Postcode = "BB1 1BB"; entity.JobRole = "Updated Job Title"; entity.PlacementsKnown = false; entity.Placements = 9; entity.SearchResultProviderCount = 25; entity.IsSaved = false; entity.IsSelectedForReferral = false; entity.IsCompleted = false; entity.ModifiedOn = new DateTime(2019, 11, 01, 12, 30, 00); entity.ModifiedBy = "UpdateTestUser"; repository.UpdateAsync(entity).GetAwaiter().GetResult(); _result = repository.GetSingleOrDefaultAsync(x => x.Id == 1) .GetAwaiter().GetResult(); }
public When_OpportunityItemRepository_GetSingleOrDefault_Is_Called_With_Non_Existent_Id() { var logger = Substitute.For <ILogger <GenericRepository <Domain.Models.OpportunityItem> > >(); using var dbContext = InMemoryDbContext.Create(); dbContext.Add(new ValidOpportunityItemBuilder().Build()); dbContext.SaveChanges(); var repository = new GenericRepository <Domain.Models.OpportunityItem>(logger, dbContext); _result = repository.GetSingleOrDefaultAsync(x => x.Id == 2) .GetAwaiter().GetResult(); }