public Statistics(IURLParametersParser parser, IStatisticsProxyService service) { this.parser = parser; this.service = service; }
public static void MyClassInitialize(TestContext testContext) { List<Dimension> dimensions = new List<Dimension> { new Dimension { ID = "1", DimensionType = DimensionType.Temporal, Name = "Ano", NameAbbr = "Ano", Attributes = new List<DimensionAttribute> { new DimensionAttribute { ID = "2010", Name = "2010" }, new DimensionAttribute { ID = "2011", Name = "2011" } } }, new Dimension { ID = "2", DimensionType = DimensionType.Geographic, Name = "Geografia", NameAbbr = "Geografia", Attributes = new List<DimensionAttribute> { new HierarchyAttribute { ID = "PT", Name = "Portugal", LazyLoad = true } }, AggregationLevels = new List<AggregationLevel> { new AggregationLevel { ID = "Districts", Level = 1, Name = "Distritos" }, new AggregationLevel { ID = "Municipalities", Level = 2, Name = "Municipios" } } }, new Dimension { ID = "3", DimensionType = DimensionType.Other, Name = "Género", NameAbbr = "Género", Attributes = new List<DimensionAttribute> { new HierarchyAttribute { ID = "all", Name = "Todos", ChildAttributes = new List<DimensionAttribute> { new DimensionAttribute { ID = "M", Name = "Masculino" }, new DimensionAttribute { ID = "F", Name = "Feminino" } } } } } }; metadata = new IndicatorMetadata { ID = "1", IndicatorName = "Indicator 1", IndicatorNameAbbr = "I1", LastUpdate = DateTime.Now, SourceName = "Test provider", SourceNameAbbr = "TP", SourceURL = "http://nowhere.com", Dimensions = dimensions }; values = new IndicatorValue[] { new IndicatorValue { Value = 2, Projected = new DimensionFilter [] { new DimensionFilter { DimensionID = "3", AttributeIDs=new string[]{ "M" } } }, Filters = new DimensionFilter[] { new DimensionFilter{ DimensionID = "1", AttributeIDs = new List<string>{ "2010", "2011" } }, new DimensionFilter{ DimensionID = "2", AttributeIDs = new List<string>{ "PT" } } } }, new IndicatorValue { Value = 4, Projected = new DimensionFilter[] { new DimensionFilter { DimensionID = "3", AttributeIDs = new string[] { "F" } } }, Filters = new DimensionFilter[] { new DimensionFilter{ DimensionID = "1", AttributeIDs = new List<string>{ "2010", "2011" } }, new DimensionFilter{ DimensionID = "2", AttributeIDs = new List<string>{ "PT" } } } } }; var mock = new Mock<IStatisticsProxyService>(); mock.Setup(m => m.GetMetadata(It.IsAny<int>(), It.IsAny<int>())).Returns(metadata); mock.Setup(m => m.GetIndicatorValues( It.IsAny<int>(), It.IsAny<int>(), It.IsAny<IEnumerable<DimensionFilter>>(), It.IsAny<IEnumerable<DimensionFilter>>()) ).Returns(new IndicatorValues { Values = values }); serviceImplementation = mock.Object; }