public async void Get() { Mock <ILogger <StateProvinceRepository> > loggerMoc = StateProvinceRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = StateProvinceRepositoryMoc.GetContext(); var repository = new StateProvinceRepository(loggerMoc.Object, context); StateProvince entity = new StateProvince(); context.Set <StateProvince>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.StateProvinceID); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <StateProvinceRepository> > loggerMoc = StateProvinceRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = StateProvinceRepositoryMoc.GetContext(); var repository = new StateProvinceRepository(loggerMoc.Object, context); StateProvince entity = new StateProvince(); context.Set <StateProvince>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.StateProvinceID); await repository.Update(record); var modifiedRecord = context.Set <StateProvince>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }