コード例 #1
0
        public void GeAlltDataSources_Successful()
        {
            //  Arrange:
            //  Accessing data direct from data store, so keep to base data.
            //  Always check for the minimum test data, as other data could be
            //  there because of the imports, so do not check for any cases
            //  where the import data could be included.  Don't check for things
            //  like import or updated dates as these cannot be guaranteed and
            //  result in a false negative test.
            var dataService = new DataService(_repository, _dataSourceRepository, _dataTypeRepository, _importServiceResolver, _dataSourceResolver);

            //  Act
            var result = dataService.GeDataSources().ToArray();
            var minDatasources = (result.Count() >= 2) ? true : false;

            //  Assert
            Assert.IsNotNull(result, "Expected some datasources to be returned.");
            Assert.IsTrue(minDatasources, "Expected at least 2 datasources to be returned 'SNH & RenUK'.");
            Assert.AreEqual("Scottish Natural Heritage KML Source", result[0].Title, "Expected 'SNH' as the first datasource");
            Assert.AreEqual("RenewableUk WebSite", result[1].Title, "Expected 'RenUk' as the second datasource");
        }
コード例 #2
0
        public void GetDataSources_Successful_Returns2()
        {
            //  Arrange
            _mockDatasourceRepository.Setup(r => r.GetAll()).Returns(_datasources.AsQueryable());

            var dataService = new DataService(_mockAggregateRepository.Object,
                _mockDatasourceRepository.Object, _mockDataTypeRepository.Object,
                _mockImportServiceResolver.Object, _mockDataSourceResolver.Object);

            //  Act
            var results = dataService.GeDataSources().ToArray();

            //  Assert
            Assert.AreEqual(2, results.Count(), "Expected 2 results to be returned.");
            Assert.AreEqual("Test Service 1", results[0].Title, "Expected first datasource title to be 'Test Service 1'.");
            Assert.AreEqual("Test Service 2", results[1].Title, "Expected second datasource title to be 'Test Service 2'.");
        }