public void GetInvalidDataSource_Unsuccessful() { // Arrange: var dataService = new DataService(_repository, _dataSourceRepository, _dataTypeRepository, _importServiceResolver, _dataSourceResolver); // Act var result = dataService.GetDataSource(NonExistentDataSource); // Assert Assert.IsNull(result, "Expected no datasource to be returned."); }
public void GetSNHDataSource_Successful() { // Arrange: var dataService = new DataService(_repository, _dataSourceRepository, _dataTypeRepository, _importServiceResolver, _dataSourceResolver); // Act var result = dataService.GetDataSource(SnhDataSourceId); // Assert Assert.IsNotNull(result, "Expected 'SNH' datasource to be returned."); Assert.AreEqual("Scottish Natural Heritage KML Source", result.Title, "Expected 'SNH' as the first datasource"); }
public void GetDataSource_Successful_ReturnsDatasource2() { // Arrange _mockDatasourceRepository.Setup(r => r.Get(It.IsAny<int>())).Returns(_dataSource2); var dataService = new DataService(_mockAggregateRepository.Object, _mockDatasourceRepository.Object, _mockDataTypeRepository.Object, _mockImportServiceResolver.Object, _mockDataSourceResolver.Object); // Act var result = dataService.GetDataSource(2); // Assert Assert.AreEqual("Test Service 2", result.Title, "Expected datasource title to be 'Test Service 2'."); }