Beispiel #1
0
        public ResourceStatisticsServiceTests()
        {
            _mockStatisticsRepository = new Mock <IResourceStatisticsRepository>();
            _mockMetadataService      = new Mock <IMetadataService>();

            // Init testdata
            _statisticsService = new ResourceStatisticsService(_mockStatisticsRepository.Object, _mockMetadataService.Object);

            _numberOfProperties   = new PropertyStatisticsBuilder().GenerateSampleCountOfPropertiesData().Build();
            _propertyUsageByGroup = new PropertyStatisticsBuilder().GenerateSamplePropertyUsageByGroupData().Build();
            _cvSelection          = new PropertyStatisticsBuilder().GenerateSampleControlledVocabularySelectionData().Build();

            _mockStatisticsRepository.Setup(s => s.GetNumberOfProperties(It.IsAny <List <string> >())).Returns(_numberOfProperties.Counts);
            _mockStatisticsRepository.Setup(s => s.GetNumberOfPropertyUsageByGroupOfResource(It.IsAny <Uri>())).Returns(_propertyUsageByGroup.Counts);
            _mockStatisticsRepository.Setup(s => s.GetNumberOfControlledVocabularySelection(It.IsAny <Uri>(), It.IsAny <List <string> >())).Returns(_cvSelection);
        }
 /// <summary>
 /// API endpoint for statistics information.
 /// </summary>
 /// <param name="resourceStatisticsService">The service for status information</param>
 public StatisticsController(IResourceStatisticsService resourceStatisticsService)
 {
     _resourceStatisticsService = resourceStatisticsService;
 }