public void TestGetDataReturnsNullIfInvalidGroupId()
        {
            var area = Area;
            var timePeriod = new TimePeriod();
            var grouping = new Grouping { GroupId = RuleShouldCcgAverageBeCalculatedForGroup.InvalidId };

            CcgCoreDataSetProvider provider = new CcgCoreDataSetProvider(area,
                ValidPopulationProvider(),
                ValidDataListProvider(grouping, area, timePeriod),
                EmptyGroupDataReader(grouping, timePeriod));
            var coreDataSet = provider.GetData(grouping, timePeriod, new IndicatorMetadata());

            Assert.IsNull(coreDataSet);
        }
        public void TestCheckDatabaseForValueBeforeCalculating()
        {
            double valueInDatabase = 2;

            Area area = Area;
            var timePeriod = new TimePeriod();
            var grouping = new Grouping();

            var groupDataReader = new Mock<GroupDataReader>(MockBehavior.Strict);
            groupDataReader.Protected();
            groupDataReader.Setup(x => x
                .GetCoreData(grouping, timePeriod, areaCode))
                .Returns(new List<CoreDataSet> { new CoreDataSet { Value = valueInDatabase } });

            CcgCoreDataSetProvider provider = new CcgCoreDataSetProvider(area, null, null, groupDataReader.Object);
            var coreDataSet = provider.GetData(grouping, timePeriod, null);

            Assert.AreEqual(valueInDatabase, coreDataSet.Value);
        }
        public void TestValidData()
        {
            Area area = Area;
            var timePeriod = new TimePeriod();
            var grouping = new Grouping();

            CcgCoreDataSetProvider provider = new CcgCoreDataSetProvider(area,
                ValidPopulationProvider(),
                ValidDataListProvider(grouping, area, timePeriod),
                EmptyGroupDataReader(grouping, timePeriod));
            var coreDataSet = provider.GetData(grouping, timePeriod, new IndicatorMetadata());

            Assert.AreEqual(practiceValue, coreDataSet.Value);
        }
        public void TestGetDataReturnsNullIfNoChildPracticeData()
        {
            Area area = Area;
            var timePeriod = new TimePeriod();
            var grouping = new Grouping();

            CcgCoreDataSetProvider provider = new CcgCoreDataSetProvider(area,
                ValidPopulationProvider(),
                EmptyDataListProvider(grouping, area, timePeriod),
                EmptyGroupDataReader(grouping, timePeriod));
            var coreDataSet = provider.GetData(grouping, timePeriod, new IndicatorMetadata());

            Assert.IsNull(coreDataSet);
        }