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