public async Task GetAll_WithZeroData_ShouldReturnEmptyResults() { string errorMessagePrefix = "AssetTypes GetAll() method does not work properly."; var context = OmmDbContextInMemoryFactory.InitializeContext(); this.assetTypesService = new AssetTypesService(context); List <AssetTypeSelectListDto> actualResults = await this.assetTypesService.GetAll().ToListAsync(); Assert.True(actualResults.Count == 0, errorMessagePrefix + " " + "Count of returned asset types is not correct"); }
public async Task GetAll_WithDummyData_ShouldReturnCorrectResults() { string errorMessagePrefix = "AssetTypes GetAll() method does not work properly."; var context = OmmDbContextInMemoryFactory.InitializeContext(); await SeedData(context); this.assetTypesService = new AssetTypesService(context); List <AssetTypeSelectListDto> actualResults = await this.assetTypesService.GetAll().ToListAsync(); List <AssetTypeSelectListDto> expectedResults = GetDummyData().To <AssetTypeSelectListDto>().ToList(); for (int i = 0; i < expectedResults.Count; i++) { var expectedEntry = expectedResults[i]; var actualEntry = actualResults[i]; Assert.True(expectedEntry.Id == actualEntry.Id, errorMessagePrefix + " " + "Id is not returned properly."); Assert.True(expectedEntry.Name == actualEntry.Name, errorMessagePrefix + " " + "Name is not returned properly."); } Assert.True(expectedResults.Count == actualResults.Count, errorMessagePrefix + " " + "Count of returned asset types is not correct"); }
public AssetTypeSelectListViewComponent(IAssetTypesService assetTypesService) { this.assetTypesService = assetTypesService; }
public AssetTypesController(IAssetTypesService assetTypesService, IConvertService convertService) { _assetTypesService = assetTypesService; _convertService = convertService; }