public async Task ReadCluster_ById(string id) { var dbContext = DbContextTestHelper.GetDbContext(); fixture.AddSeed(dbContext); var mock = new Mock <ILogger <ClusterRepository> >(); ILogger <ClusterRepository> logger = mock.Object; var repository = new ClusterRepository(logger, dbContext); var node = await repository.ReadAsync(c => c.Id == id); Assert.NotNull(node); }
public async Task DeleteCluster_ById(string id) { var dbContext = DbContextTestHelper.GetDbContext(); fixture.AddSeed(dbContext); var mock = new Mock <ILogger <ClusterRepository> >(); ILogger <ClusterRepository> logger = mock.Object; var repository = new ClusterRepository(logger, dbContext); var cluster = await repository.ReadAsync(c => c.Id == id); Assert.NotNull(cluster); cluster.DeleteAt = DateTime.UtcNow; var deleted = await repository.DeleteAsync(cluster); Assert.Equal(1, deleted); }
public async Task UpdateCluster_ById_UpdateNode(string id, int node) { var dbContext = DbContextTestHelper.GetDbContext(); fixture.AddSeed(dbContext); var mock = new Mock <ILogger <ClusterRepository> >(); ILogger <ClusterRepository> logger = mock.Object; var repository = new ClusterRepository(logger, dbContext); var cluster = await repository.ReadAsync(c => c.Id == id); Assert.NotNull(cluster); cluster.Node = node; var updated = await repository.UpdateAsync(cluster); Assert.Equal(1, updated); }