public void GetEditModuleActionsSuccess() { //Arrange var moduleRepository = new ModuleRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var modules = TestDataRepository.GetModules(); foreach (var item in modules) { item.ModuleAction.First().ModuleActionType.ControlType = "edit"; moduleRepository.Create(item); } var moduleId = modules.First().Id; //Act var result = moduleRepository.GetEditModuleActions(moduleId); var resultItem = result.First(); //Assert Assert.NotNull(result); Assert.True(result.Count > 0); Assert.NotNull(resultItem); Assert.NotEqual(resultItem.Id, Guid.Empty); Assert.True(!string.IsNullOrEmpty(resultItem.ActionName)); Assert.True(!string.IsNullOrEmpty(resultItem.ControllerName)); Assert.True(!string.IsNullOrEmpty(resultItem.ControllerNamespace)); Assert.True(!string.IsNullOrEmpty(resultItem.DisplayName)); Assert.True(!string.IsNullOrEmpty(resultItem.IconClass)); Assert.True(resultItem.ModuleActionTypeId != Guid.Empty); //Clean dbContext.Module.RemoveRange(dbContext.Module); }
public void GetEditModuleActionsFail() { //Arrange var moduleRepository = new ModuleRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var modules = TestDataRepository.GetModules(); foreach (var item in modules) { moduleRepository.Create(item); } var moduleId = Guid.NewGuid(); //Act var result = moduleRepository.GetEditModuleActions(moduleId); //Assert Assert.NotNull(result); Assert.True(result.Count == 0); //Clean dbContext.Module.RemoveRange(dbContext.Module); }