public async void Create() { Mock <ILogger <PipelineStatuRepository> > loggerMoc = PipelineStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStatuRepositoryMoc.GetContext(); var repository = new PipelineStatuRepository(loggerMoc.Object, context); var entity = new PipelineStatu(); await repository.Create(entity); var record = await context.Set <PipelineStatu>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Get() { Mock <ILogger <PipelineStatuRepository> > loggerMoc = PipelineStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStatuRepositoryMoc.GetContext(); var repository = new PipelineStatuRepository(loggerMoc.Object, context); PipelineStatu entity = new PipelineStatu(); context.Set <PipelineStatu>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Delete() { Mock <ILogger <PipelineStatuRepository> > loggerMoc = PipelineStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStatuRepositoryMoc.GetContext(); var repository = new PipelineStatuRepository(loggerMoc.Object, context); PipelineStatu entity = new PipelineStatu(); context.Set <PipelineStatu>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); PipelineStatu modifiedRecord = await context.Set <PipelineStatu>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_Tracked() { Mock <ILogger <PipelineStatuRepository> > loggerMoc = PipelineStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStatuRepositoryMoc.GetContext(); var repository = new PipelineStatuRepository(loggerMoc.Object, context); PipelineStatu entity = new PipelineStatu(); context.Set <PipelineStatu>().Add(entity); await context.SaveChangesAsync(); await repository.Update(new PipelineStatu()); var modifiedRecord = context.Set <PipelineStatu>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }