public async void Create() { Mock <ILogger <MachineRepository> > loggerMoc = MachineRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = MachineRepositoryMoc.GetContext(); var repository = new MachineRepository(loggerMoc.Object, context); var entity = new Machine(); await repository.Create(entity); var record = await context.Set <Machine>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Create() { Mock <ILogger <MachineRepository> > loggerMoc = MachineRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = MachineRepositoryMoc.GetContext(); var repository = new MachineRepository(loggerMoc.Object, context); var entity = new Machine(); entity.SetProperties(default(int), "B", "B", "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B"); await repository.Create(entity); var records = await context.Set <Machine>().ToListAsync(); records.Count.Should().Be(2); }