示例#1
0
        public INyssContext GetNyssContextMock()
        {
            var nyssContextMock = Substitute.For <INyssContext>();

            var nationalSocietiesDbSet  = NationalSocieties.AsQueryable().BuildMockDbSet();
            var healthRisksDbSet        = HealthRisks.AsQueryable().BuildMockDbSet();
            var alertRulesDbSet         = AlertRules.AsQueryable().BuildMockDbSet();
            var projectsDbSet           = Projects.AsQueryable().BuildMockDbSet();
            var projectHealthRisksDbSet = ProjectHealthRisks.AsQueryable().BuildMockDbSet();
            var dataCollectorsDbSet     = DataCollectors.AsQueryable().BuildMockDbSet();
            var reportsDbSet            = Reports.AsQueryable().BuildMockDbSet();
            var rawReportsDbSet         = RawReports.AsQueryable().BuildMockDbSet();
            var usersDbSet = Users.AsQueryable().BuildMockDbSet();
            var supervisorUserProjectsDbSet = SupervisorUserProjects.AsQueryable().BuildMockDbSet();
            var userNationalSocietiesDbSet  = UserNationalSocieties.AsQueryable().BuildMockDbSet();
            var regionsDbSet   = Regions.AsQueryable().BuildMockDbSet();
            var districtsDbSet = Districts.AsQueryable().BuildMockDbSet();
            var villagesDbSet  = Villages.AsQueryable().BuildMockDbSet();
            var zonesDbSet     = Zones.AsQueryable().BuildMockDbSet();
            var alertsDbSet    = Alerts.AsQueryable().BuildMockDbSet();

            nyssContextMock.NationalSocieties.Returns(nationalSocietiesDbSet);
            nyssContextMock.HealthRisks.Returns(healthRisksDbSet);
            nyssContextMock.AlertRules.Returns(alertRulesDbSet);
            nyssContextMock.Projects.Returns(projectsDbSet);
            nyssContextMock.ProjectHealthRisks.Returns(projectHealthRisksDbSet);
            nyssContextMock.DataCollectors.Returns(dataCollectorsDbSet);
            nyssContextMock.Reports.Returns(reportsDbSet);
            nyssContextMock.RawReports.Returns(rawReportsDbSet);
            nyssContextMock.Users.Returns(usersDbSet);
            nyssContextMock.SupervisorUserProjects.Returns(supervisorUserProjectsDbSet);
            nyssContextMock.UserNationalSocieties.Returns(userNationalSocietiesDbSet);
            nyssContextMock.Regions.Returns(regionsDbSet);
            nyssContextMock.Districts.Returns(districtsDbSet);
            nyssContextMock.Villages.Returns(villagesDbSet);
            nyssContextMock.Zones.Returns(zonesDbSet);
            nyssContextMock.Alerts.Returns(alertsDbSet);

            return(nyssContextMock);
        }