public void GetLayoutSuccess() { //Arrange var layoutTypeRepository = new LayoutTypeRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layoutTypes = TestDataRepository.GetLayoutTypes(); foreach (var item in layoutTypes) { layoutTypeRepository.CreateLayoutType(item); } var id = layoutTypes.First().Id; //Act var result = layoutTypeRepository.GetLayoutType(id); //Assert Assert.NotNull(result); Assert.NotEqual(result.Id, Guid.Empty); Assert.False(result.IsActive); Assert.True(!string.IsNullOrEmpty(result.Name)); Assert.True(!string.IsNullOrEmpty(result.Label)); Assert.True(!string.IsNullOrEmpty(result.LayoutTypeIds)); Assert.True(result.CreatedDate > DateTime.MinValue); Assert.True(result.LastModifiedDate > DateTime.MinValue); //Clean dbContext.LayoutType.RemoveRange(dbContext.LayoutType); }
public void GetLayoutTypeFail(string typeName) { var layoutTypeRepository = new LayoutTypeRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layoutTypes = TestDataRepository.GetLayoutTypes(); foreach (var item in layoutTypes) { layoutTypeRepository.CreateLayoutType(item); } //Act var result = layoutTypeRepository.GetLayoutType(typeName); //Assert Assert.Null(result); }
public void GetLayoutFail() {//Arrange var layoutTypeRepository = new LayoutTypeRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layoutTypes = TestDataRepository.GetLayoutTypes(); foreach (var item in layoutTypes) { layoutTypeRepository.CreateLayoutType(item); } var id = Guid.Empty; //Act var result = layoutTypeRepository.GetLayoutType(id); //Assert Assert.Null(result); //Clean dbContext.LayoutType.RemoveRange(dbContext.LayoutType); }