public void UpdateLayoutSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } var layoutToUpdate = layoutRepository.GetLayouts().First(); //Act layoutToUpdate.IsDeleted = true; layoutToUpdate.Name = "NewName"; layoutToUpdate.Config = "[{\"Id\":\"0fcf04a2 - 3d71 - 26b0 - c371 - 6d936c6c65d8\",\"Type\":\"container\",\"LayoutTemplate\":\"container\"]"; var result = layoutRepository.UpdateLayout(layoutToUpdate); //Assert Assert.NotNull(result); Assert.True(result.Name == layoutToUpdate.Name); Assert.True(result.Config == layoutToUpdate.Config); Assert.True(result.IsDeleted == layoutToUpdate.IsDeleted); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }
public void GetLayoutsFail() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); dbContext.Layout.RemoveRange(dbContext.Layout); //Act var result = layoutRepository.GetLayouts(); //Assert Assert.NotNull(result); Assert.True(result.Count == 0); }
public void GetLayoutsSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } //Act var result = layoutRepository.GetLayouts(); //Assert Assert.NotNull(result); Assert.True(result.Count > 0); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }