コード例 #1
0
        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedStudentInformationData = GetSuppliedStudentInformation();
            suppliedRootMetricNode = GetSuppliedRootNode();
            suppliedRootMetricHierarchy = GetSuppliedRootMetricHierarchy();
            suppliedRootIEnumerableOfKeyValuePair = GetSuppliedRootKeyValuePairs();

            //Set up the mocks
            studentInformationRepository = mocks.StrictMock<IRepository<StudentInformation>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            domainMetricService = mocks.StrictMock<IDomainMetricService<StudentSchoolMetricInstanceSetRequest>>();
            metricTreeToIEnumerableOfKeyValuePairProvider = mocks.StrictMock<IMetricTreeToIEnumerableOfKeyValuePairProvider>();

            //Set expectations
            Expect.Call(studentInformationRepository.GetAll()).Return(suppliedStudentInformationData);
            Expect.Call(rootMetricNodeResolver.GetRootMetricNode()).Return(suppliedRootMetricNode);

            Expect.Call(domainMetricService.Get(null))
                .Constraints(
                    new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.StudentUSI == suppliedStudentUSI);
                        Assert.That(x.MetricVariantId == suppliedRootMetricNode.MetricVariantId);
                    })
                ).Return(suppliedRootMetricHierarchy);
            Expect.Call(metricTreeToIEnumerableOfKeyValuePairProvider.FlattenMetricTree((ContainerMetric) suppliedRootMetricHierarchy.RootNode)).Return(suppliedRootIEnumerableOfKeyValuePair);
        }
コード例 #2
0
        protected override void EstablishContext()
        {
            InitializeSuppliedData();

            //Set up the mocks
            localEducationAgencyInformationRepository = mocks.StrictMock<IRepository<LocalEducationAgencyInformation>>();
            domainMetricService = mocks.StrictMock<IDomainMetricService<LocalEducationAgencyMetricInstanceSetRequest>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            metricTreeToIEnumerableOfKeyValuePairProvider = mocks.StrictMock<IMetricTreeToIEnumerableOfKeyValuePairProvider>();
            domainSpecificMetricNodeResolver = mocks.StrictMock<IDomainSpecificMetricNodeResolver>();
    
            //Set expectations
            Expect.Call(localEducationAgencyInformationRepository.GetAll()).Return(suppliedLocalEducationAgencyInformationData);
            
            Expect.Call(rootMetricNodeResolver.GetRootMetricNode()).Return(suppliedRootMetricNode);

            Expect.Call(domainMetricService.Get(null))
                .Constraints(
                    new ActionConstraint<LocalEducationAgencyMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.LocalEducationAgencyId == suppliedLocalEducationAgencyId);
                        Assert.That(x.MetricVariantId == suppliedRootMetricVariantId);
                    })
                ).Return(suppliedRootMetricHierarchy);

            Expect.Call(metricTreeToIEnumerableOfKeyValuePairProvider.FlattenMetricTree((ContainerMetric)suppliedRootMetricHierarchy.RootNode)).Return(suppliedRootIEnumerableOfKeyValuePair);

            Expect.Call(domainSpecificMetricNodeResolver.GetOperationalDashboardMetricNode()).Return(suppliedOperationalDashboardMetricNode);

            // Mock the metric service call to obtain operational dashboards
            Expect.Call(domainMetricService.Get(null))
                .Constraints(
                    new ActionConstraint<LocalEducationAgencyMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.LocalEducationAgencyId == suppliedLocalEducationAgencyId);
                        Assert.That(x.MetricVariantId == suppliedOperationalDashboardMetricVariantId);
                    })
                ).Return(suppliedOperationalDashboardMetricHierarchy);

            MockFlatteningOfOperationDashboardsHierarchy();
        }