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