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