public DesignRequestListVm(IRepository<Request> requestRepository, IRepository<City> cityRepository, IEventAggregator eventAggregator, NavigationService navigationService)
        {
            _requestRepository = requestRepository;
            _cityRepository = cityRepository;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            Items = new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));

            _eventAggregator.GetEvent<ChangeAcceptedEvent<Hangar>>().Subscribe(_ =>

            {
                new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));
            });
        }
Example #2
0
 public OperationsClassifier(IRepository<ClassificationDefinition> classificationRepository, IRepository<BankAccount> accountsRepository)
 {
     _definitionsToApply = classificationRepository
         .GetAll()
         .Select(def =>
             new RegularExpressionClassificationRule(def, accountsRepository));
 }
		public ActionResult Create(UserInputModel userInputModel)
		{
            _repository = new InMemoryRepository();
            _authenticator = new CookieAuthenticator();

			if (_repository.GetAll<User>().Any(x => x.Username == userInputModel.Username))
			{
				ModelState.AddModelError("Username", "Username is already in use");
			}

			if (ModelState.IsValid)
			{
				var user = new User
				{
					Id = Guid.NewGuid(),
					Username = userInputModel.Username,
					Password = HashPassword(userInputModel.Password),
				};

				_repository.SaveOrUpdate(user);

                _authenticator.SetCookie("72201781859E67D4F633C34381EFE4BC928656AEE324A4B00CADA968ACD6CF33047E47479B0B68050FF4A0DB13688B5C78DAFDF53252A94E7F1D7B58A6FFD95D747F3D3AA761DECA7B6358A2E78B85D868833A9420316BDA8A5A0425D543AC1148CB69B902195C20065446A5E5F7A8E4C94A04A22304680E1211F00A12DF5E8777A343D08D0F8C0A3BFC471381E9B070E0F0608ADAEBCA8E233A21251BF57A03B52C1F03B7169CFC7C98216E7217EA649C4EDBD35E07F11A2444D40BE303BFFA28BAA921CDCC298D09A6E0297ED7D6E8");

				return RedirectToAction("Index", "Home");
			}

			return View("New", userInputModel);
		}
        protected override void EstablishContext()
        {
            schoolMetricTeacherListRepository = mocks.StrictMock<IRepository<SchoolMetricTeacherList>>();
            staffInformationRepository = mocks.StrictMock<IRepository<StaffInformation>>();
            staffEducationOrgInformationRepository = mocks.StrictMock<IRepository<StaffEducationOrgInformation>>();
            footnoteRepository = mocks.StrictMock<IRepository<MetricInstanceFootnote>>();
            uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();

            suppliedSchoolMetricTeacherList = GetSuppliedSchoolMetricTeacherList();
            suppliedStaffInformationList = GetSuppliedStaffInformationList();
            suppliedStaffEducationOrgInformationList = GetSuppliedStaffEducationOrgInformationList();
            suppliedFootnoteList = GetSuppliedFootnoteList();

            Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(schoolMetricTeacherListRepository.GetAll()).Repeat.Any().Return(suppliedSchoolMetricTeacherList);
            Expect.Call(staffEducationOrgInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffEducationOrgInformationList);
            Expect.Call(staffInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffInformationList);
            Expect.Call(footnoteRepository.GetAll()).Repeat.Any().Return(suppliedFootnoteList);
            Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedUniqueListId);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<SchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                    })
                ).Return(suppliedMetricInstanceSetKey);

        }
        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);
        }
        public RecoveryController(
            IRepository<Post> postRepository,
            IRepository<Redirect> redirectRepository,
            IRepository<BlogTemplate> styleRepository,
            IRepository<User> userRepository,
            IRepository<Securable> securableRepository,
            IRepository<TemporaryUploadedBlogBackup> tempBlogBackupRepo,
            IRepository<Data.Blog> blogRepository,
            ISecurityHelper securityHelper,
            IHttpContextService httpContext)
            : base(blogRepository, httpContext, securityHelper, userRepository, securableRepository)
        {
            _postRepository = postRepository;
            _redirectRepository = redirectRepository;
            _styleRepository = styleRepository;
            _tempBlogBackupRepo = tempBlogBackupRepo;
            _userRepository = userRepository;
            _blogRepository = blogRepository;
            _securityHelper = securityHelper;

            //Naieve clean of the collection to avoid leaks in long running instances of the application
            var toDelete = _tempBlogBackupRepo.GetAll().Where(b => b.UploadTime < DateTime.Now.AddHours(-1)).ToArray();
            foreach(var toDel in toDelete)
            {
                _tempBlogBackupRepo.Delete(toDel);
            }
        }
        protected override void EstablishContext()
        {
            metadataListRepository = mocks.StrictMock<IRepository<MetadataList>>();
            Expect.Call(metadataListRepository.GetAll()).Repeat.Any().Return(GetMetadataList());

            base.EstablishContext();
        }
        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedListMetadata = GetSuppliedListMetadata();
            suppliedStudentRow = GetSuppliedStudentRow();
            suppliedPriorYearStudentRow = GetSuppliedPriorYearStudentList();
            suppliedMetricVariants = GetSuppliedMetricVariants();

            //Set up the mocks
            listMetadataProvider = mocks.StrictMock<IListMetadataProvider>();
            studentListUtilitiesProvider = mocks.StrictMock<IStudentListUtilitiesProvider>();
            trendRenderingDispositionProvider = mocks.StrictMock<ITrendRenderingDispositionProvider>();
            metricStateProvider = mocks.StrictMock<IMetricStateProvider>();
            metricVariantRepository = mocks.StrictMock<IRepository<MetricVariant>>();

            windsorContainer = new WindsorContainer();
            windsorContainer.Kernel.Resolver.AddSubResolver(new ArrayResolver(windsorContainer.Kernel));
            RegisterProviders(windsorContainer);
            IoC.Initialize(windsorContainer);

            additionalPriorYearMetricProvider = IoC.Resolve<IAdditionalPriorYearMetricProvider>();

            Expect.Call(metricVariantRepository.GetAll())
                .Return(suppliedMetricVariants.AsQueryable()).Repeat.AtLeastOnce();
        }
        protected override void EstablishContext()
        {
            staffStudentCohortRepository = mocks.StrictMock<IRepository<StaffStudentCohort>>();
            Expect.Call(staffStudentCohortRepository.GetAll()).Return(new List<StaffStudentCohort>
            {
                new StaffStudentCohort { StaffCohortId = 1, StudentUSI = 1 },
                new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 2 },
                new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 3 },
            }.AsQueryable()).Repeat.Any();

            staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>();
            Expect.Call(staffCohortRepository.GetAll()).Return(new List<StaffCohort>
            {
                new StaffCohort { StaffCohortId = 1, },
                new StaffCohort { StaffCohortId = 2, },
            }.AsQueryable()).Repeat.Any();

            staffStudentAssociationRepository = mocks.StrictMock<IRepository<StaffStudentAssociation>>();
            Expect.Call(staffStudentAssociationRepository.GetAll()).Return(new List<StaffStudentAssociation>().AsQueryable()).Repeat.Any();

            query = new List<EnhancedStudentInformation>
            {
                new EnhancedStudentInformation { StudentUSI = 1, },
                new EnhancedStudentInformation { StudentUSI = 2, },
                new EnhancedStudentInformation { StudentUSI = 3, },
            }.AsQueryable();

            filter = new StaffCohortFilter(staffStudentCohortRepository);

            base.EstablishContext();
        }
        protected override void EstablishContext()
        {
            SetSuppliedGoal();

            localEducationAgencyMetricSchoolListRepository = mocks.StrictMock<IRepository<LocalEducationAgencyMetricInstanceSchoolList>>();
            schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>();
            uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>();
            metricCorrelationService = mocks.StrictMock<IMetricCorrelationProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<LocalEducationAgencyMetricInstanceSetRequest>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>();
            maxPriorYearProvider = mocks.StrictMock<IMaxPriorYearProvider>();

            suppliedLocalEducationAgencyMetricSchoolList = GetSuppliedLocalEducationAgencyMetricSchoolList();
            suppliedSchoolInformationList = GetSuppliedSchoolInformationRepository();

            Expect.Call(warehouseAvailabilityProvider.Get()).Return(true);
            Expect.Call(maxPriorYearProvider.Get(suppliedLocalEducationAgencyId)).Return(2011);
            Expect.Call(metricNodeResolver.GetMetricNodeForLocalEducationAgencyMetricVariantId(suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(localEducationAgencyMetricSchoolListRepository.GetAll()).Repeat.Any().Return(suppliedLocalEducationAgencyMetricSchoolList);
            Expect.Call(schoolInformationRepository.GetAll()).Return(suppliedSchoolInformationList);
            Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedListContext);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)).Constraints(
                    new ActionConstraint<LocalEducationAgencyMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                        Assert.That(x.LocalEducationAgencyId == suppliedLocalEducationAgencyId);
                    })).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal);

            Expect.Call(metricCorrelationService.GetRenderingParentMetricVariantIdForSchool(suppliedMetricVariantId, 1)).Constraints(
                     Rhino.Mocks.Constraints.Is.Equal(suppliedMetricVariantId), Rhino.Mocks.Constraints.Is.Anything()).Repeat.Any().Return(new MetricCorrelationProvider.MetricRenderingContext { ContextMetricVariantId = suppliedContextMetricVariantId, MetricVariantId = suppliedCorrelationMetricVariantId });
        }
        public void Add_Should_Result_In_Proper_Total_Items(IRepository<Contact, string> repository)
        {
            repository.Add(new Contact { Name = "Test User" });

            var result = repository.GetAll();
            result.Count().ShouldEqual(1);
        }
        static async Task MainAsync(IRepository<SampleEntity> repo)
        {
            foreach (var s in await repo.GetAllAsync())
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }

            // Paged Set //
            Console.WriteLine("\nPage = 2 - Page Size = 2 :");
            var some = await repo.GetAsync(2, 2, s => s.ID);
            foreach (var s in some)
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }
                
            // Updating //
            var fox = await repo.FindAsync(e => e.Name == "Fox");
            fox.Name = "Dog";

            repo.Update(fox, fox.ID);

            // Deleting //
            Console.WriteLine("\n " + await repo.DeleteAsync(repo.Get(5)) + "\n");

            foreach (var e in repo.GetAll())
                Console.WriteLine(e.ID + " | " + e.Name);
        }
        protected override void EstablishContext()
        {
            repository = mocks.StrictMock<IRepository<EdFi.Dashboards.Application.Data.Entities.LocalEducationAgency>>();
            Expect.Call(repository.GetAll()).Return(GetLocalEducationAgency());

            resolutionService = new RouteValueResolutionService(repository);
        }
        protected override void EstablishContext()
        {
            SetSuppliedGoal();

            base.EstablishContext();

            suppliedData = GetData();

            repository = mocks.StrictMock<IRepository<SchoolMetricGradeDistribution>>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();

            Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(repository.GetAll()).Return(suppliedData);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<SchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                    })
                ).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal);
        }
        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedStudentMetricBenchmarkAssessmentData = GetSuppliedStudentMetricBenchmarkAssessment();
            suppliedSchoolGoal = GetSuppliedMetricGoal();
            suppliedMetricState = GetSuppliedMetricState();

            //Set up the mocks
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            studentMetricBenchmarkAssessmentRepository = mocks.StrictMock<IRepository<StudentMetricBenchmarkAssessment>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricStateProvider = mocks.StrictMock<IMetricStateProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<StudentSchoolMetricInstanceSetRequest>>();

            //Set expectations
            Expect.Call(metricNodeResolver.GetMetricNodeForStudentFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetMetricMetadataNode());
            Expect.Call(studentMetricBenchmarkAssessmentRepository.GetAll()).Return(suppliedStudentMetricBenchmarkAssessmentData);
            Expect.Call(
                metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                        Assert.That(x.StudentUSI == suppliedStudentUSI);
                    })
                ).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedSchoolGoal);
            Expect.Call(metricStateProvider.GetState(suppliedMetricId, suppliedMetricValueStr, "System.Double")).Repeat.Any().Return(suppliedMetricState);
            Expect.Call(metricStateProvider.GetState(suppliedMetricId, "", "System.Double")).Return(suppliedMetricState);
        }
 public DashboardViewModel(
     IRepository<ClassModel> repository)
 {
     _repository = repository;
     Title = "My window";
     Classes = new ObservableCollection<ClassModel>(_repository.GetAll().Result);
 }
        protected override void EstablishContext()
        {
            LeaContextProvider = mocks.StrictMock<ILocalEducationAgencyContextProvider>();
            LocalEducationAgencyApplicationRepository = mocks.StrictMock<IRepository<EdFi.Dashboards.Application.Data.Entities.LocalEducationAgency>>();
            LocalEducationAgencyApplicationAuthRepository = mocks.StrictMock<IRepository<Dashboards.Application.Data.Entities.LocalEducationAgencyAuthentication>>();


            Expect.Call(LeaContextProvider.GetCurrentLocalEducationAgencyCode()).Repeat.Any().Return("1");

            Expect.Call(LocalEducationAgencyApplicationRepository.GetAll()).Repeat.Any().Return(new List<Dashboards.Application.Data.Entities.LocalEducationAgency>
                                                                                                                      {
                                                                                                                          new Dashboards.Application.Data.Entities.LocalEducationAgency
                                                                                                                              {
                                                                                                                                  LocalEducationAgencyId = 1,
                                                                                                                                  Name = "Test",
                                                                                                                                  Code = "1"
                                                                                                                              }
                                                                                                                      }.AsQueryable());

            Expect.Call(LocalEducationAgencyApplicationAuthRepository.GetAll()).Repeat.Any().Return(new List<Dashboards.Application.Data.Entities.LocalEducationAgencyAuthentication>
                                                                                                        {
                                                                                                            new LocalEducationAgencyAuthentication
                                                                                                                {
                                                                                                                    LocalEducationAgencyId = 1,
                                                                                                                    StaffInformationLookupKey = ExpectedValue,
                                                                                                                    LdapLookupKey = string.Empty
                                                                                                                }
                                                                                                        }.AsQueryable());

            base.EstablishContext();
        }
        protected override void EstablishContext()
        {
            schoolMetricHistoricalRepository = mocks.StrictMock<IRepository<SchoolMetricHistorical>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricStateProvider = mocks.StrictMock<IMetricStateProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>();
            trendRenderingDispositionProvider = mocks.StrictMock<ITrendRenderingDispositionProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>();

            suppliedSchoolMetricHistorical = GetSuppliedSchoolMetricHistorical();

            Expect.Call(warehouseAvailabilityProvider.Get()).Return(true);
            Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(schoolId1, metricVariantId1)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(schoolMetricHistoricalRepository.GetAll()).Repeat.Any().Return(suppliedSchoolMetricHistorical);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedSchoolMetricInstanceSetKey1, metricId1)).Return(schoolGoal1);
            //This is tested elsewhere so we ignore and return a fixed value.
            Expect.Call(metricStateProvider.GetState(1, ".0", "System.IgnoreThisParam")).IgnoreArguments().Repeat.Any().
                Return(new State(MetricStateType.Good, "Good"));

            Expect.Call(
                metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<SchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == schoolId1);
                        Assert.That(x.MetricVariantId == metricVariantId1);
                    })
                ).
                Return(suppliedSchoolMetricInstanceSetKey1);

            Expect.Call(trendRenderingDispositionProvider.GetTrendRenderingDisposition(TrendDirection.Decreasing, TrendInterpretation.Standard)).IgnoreArguments().Repeat.Any().Return(TrendEvaluation.UpNoOpinion);
        }
        protected override void EstablishContext()
        {
            schoolMetricInstanceTeacherListRepository = mocks.StrictMock<IRepository<SchoolMetricInstanceTeacherList>>();
            staffInformationRepository = mocks.StrictMock<IRepository<StaffInformation>>();
            staffEdOrgRepository = mocks.StrictMock<IRepository<StaffEducationOrgInformation>>();
            uniqueListProvider = mocks.StrictMock<IUniqueListIdProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            staffLinks = mocks.StrictMock<IStaffAreaLinks>();
            codeIdProvider = mocks.StrictMock<ICodeIdProvider>();
            localEducationAgencyContextProvider = mocks.StrictMock<ILocalEducationAgencyContextProvider>();
            warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>();
            maxPriorYearProvider = mocks.StrictMock<IMaxPriorYearProvider>();

            Expect.Call(warehouseAvailabilityProvider.Get()).Return(suppliedWarehouseAvailability);

            if (suppliedWarehouseAvailability)
            {
                Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(-1, -1)).IgnoreArguments().Return(GetMetricMetadataNode());
                Expect.Call(localEducationAgencyContextProvider.GetCurrentLocalEducationAgencyCode()).Return("Code");
                Expect.Call(codeIdProvider.Get("Code")).Return(1);
                Expect.Call(maxPriorYearProvider.Get(1)).Return(2012);
                Expect.Call(schoolMetricInstanceTeacherListRepository.GetAll()).Return(GetSuppliedSchoolMetricInstanceTeacherList());
                Expect.Call(uniqueListProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedUniqueId);


                if (isStaffCountGreaterThanZero)
                {
                    Expect.Call(staffEdOrgRepository.GetAll()).Return(GetSuppliedStaffEdOrg());
                    Expect.Call(staffInformationRepository.GetAll()).Return(GetStaffInformation());
                    Expect.Call(staffLinks.Default(-1, -1, string.Empty, null, null, null)).IgnoreArguments().Return(string.Empty);
                }
            }

            base.EstablishContext();
        }
        protected override void EstablishContext()
        {
            staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>();
            staffStudentCohortRepository = mocks.StrictMock<IRepository<StaffStudentCohort>>();
            staffCustomStudentListRepository = mocks.StrictMock<IRepository<StaffCustomStudentList>>();
            staffCustomStudentListStudentRepository = mocks.StrictMock<IRepository<StaffCustomStudentListStudent>>();
            schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>();
            studentInformationRepository = mocks.StrictMock<IRepository<StudentInformation>>();
            studentSchoolInformationRepository = mocks.StrictMock<IRepository<StudentSchoolInformation>>();
            studentIndicatorRepository = mocks.StrictMock<IRepository<StudentIndicator>>();
            metricInstanceRepository = mocks.StrictMock<IRepository<MetricInstance>>();
            studentSchoolMetricInstanceSetRepository = mocks.StrictMock<IRepository<StudentSchoolMetricInstanceSet>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            gradeLevelUtilitiesProvider = new GradeLevelUtilitiesProvider();

            Expect.Call(staffCohortRepository.GetAll()).Repeat.Any().Return(GetStaffCohortRepositoryInformation());
            Expect.Call(staffStudentCohortRepository.GetAll()).Repeat.Any().Return(GetStaffStudentCohortRepositoryInformation());
            Expect.Call(staffCustomStudentListRepository.GetAll()).Repeat.Any().Return(GetStaffCustomStudentListRepositoryInformation());
            Expect.Call(staffCustomStudentListStudentRepository.GetAll()).Repeat.Any().Return(GetStaffCustomStudentListStudentRepositoryInformation());
            Expect.Call(schoolInformationRepository.GetAll()).Repeat.Any().Return(GetSchoolInformation());
            Expect.Call(studentInformationRepository.GetAll()).Repeat.Any().Return(GetStudentInformation());
            Expect.Call(studentSchoolInformationRepository.GetAll()).Repeat.Any().Return(GetStudentSchoolInformation());
            Expect.Call(metricInstanceRepository.GetAll()).Return(GetMetricInstance());
            Expect.Call(studentSchoolMetricInstanceSetRepository.GetAll()).Return(GetStudentSchoolMetricInstanceSet());

            Expect.Call(rootMetricNodeResolver.GetRootMetricNodeForStudent(suppliedSchoolId1)).Repeat.Any().Return(GetSuppliedMetadataHierarchy().Children.First());

            base.EstablishContext();
        }
        protected override void EstablishContext()
        {
            base.EstablishContext();

            suppliedData = GetData();
            repository = mocks.StrictMock<IRepository<StudentMetricAbsencesByClass>>();
            Expect.Call(repository.GetAll()).Return(suppliedData);
        }
Example #22
0
        protected override void EstablishContext()
        {
            repository = mocks.StrictMock<IRepository<LocalEducationAgencyInformation>>();

            suppliedLocalEducationAgencyInformation = GetSuppliedLocalEducationAgencyData();

            Expect.Call(repository.GetAll()).Return(suppliedLocalEducationAgencyInformation);
        }
        public void Add_InBatchMode_Should_Delay_The_Action(IRepository<Contact, string> repository)
        {
            using (var batch = repository.BeginBatch())
            {
                batch.Add(new Contact { Name = "Test User 1" });

                repository.GetAll().Count().ShouldEqual(0); // shouldn't have really been added yet

                batch.Add(new Contact { Name = "Test User 2" });

                repository.GetAll().Count().ShouldEqual(0); // shouldn't have really been added yet

                batch.Commit();
            }

            repository.GetAll().Count().ShouldEqual(2);
        }
        public void Delete_Should_Remove_Multiple_Items(IRepository<Contact, string> repository)
        {
            IList<Contact> contacts = new List<Contact>
                                        {
                                            new Contact {Name = "Contact 1"},
                                            new Contact {Name = "Contact 2"},
                                            new Contact {Name = "Contact 3"},
                                        };

            repository.Add(contacts);
            var items = repository.GetAll().ToList();
            items.Count().ShouldEqual(3);

            repository.Delete(contacts.Take(2));
            items = repository.GetAll().ToList();
            items.Count().ShouldEqual(1);
            items.First().Name.ShouldEqual("Contact 3");
        }
        public static bool HasStudents(IRepository<StaffStudentAssociation> staffStudentAssociationRepository, AssociatedSchool associatedSchool, UserInformation userInformation)
        {
            var staffStudenAssociation = (from ssa in staffStudentAssociationRepository.GetAll()
                                          where ssa.StaffUSI == userInformation.StaffUSI &&
                                                ssa.SchoolId == associatedSchool.SchoolId
                                          select ssa).FirstOrDefault();

            return staffStudenAssociation != null;
        }
        protected override void EstablishContext()
        {
            suppliedMetricInstanceSetKey_ForWantedData = new Guid("56cff024-f54a-4a7f-89c2-5af94a4660da");
            suppliedMetricInstanceSetKey_ForNOTWantedData_0 = new Guid("26A3CB30-F849-4C57-A7EA-D600D409E687");
            suppliedMetricInstanceSetKey_ForNOTWantedData_1 = new Guid("FD473AB7-BF77-48D8-ADA1-B3CBC2DF5D44");

            metricComponentRepository = mocks.StrictMock<IRepository<MetricComponent>>();
            Expect.Call(metricComponentRepository.GetAll()).Return(GetSuppliedMetricComponentData());
        }
        protected override void EstablishContext()
        {
            base.EstablishContext();

            repository = mocks.StrictMock<IRepository<StudentMetricLearningObjective>>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            Expect.Call(metricNodeResolver.GetMetricNodeForStudentFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetMetricMetadataNode());
            Expect.Call(repository.GetAll()).Return(GetData());
        }
        public void Delete_Predicate_Should_Remove_Multiple_Items(IRepository<Contact, string> repository)
        {
            IList<Contact> contacts = new List<Contact>
                                        {
                                            new Contact {Name = "Contact 1", ContactTypeId = 1},
                                            new Contact {Name = "Contact 2", ContactTypeId = 1},
                                            new Contact {Name = "Contact 3", ContactTypeId = 3},
                                        };

            repository.Add(contacts);
            var items = repository.GetAll().ToList();
            items.Count().ShouldEqual(3);

            repository.Delete(x => x.ContactTypeId < 3);
            items = repository.GetAll().ToList();
            items.Count().ShouldEqual(1);
            items.First().Name.ShouldEqual("Contact 3");
        }
        public void Delete_By_Params_Should_Remove_Multiple_Items(IRepository<Contact, string> repository)
        {
            var contact1 = new Contact {Name = "Contact 1", ContactTypeId = 1};
            var contact2 = new Contact {Name = "Contact 2", ContactTypeId = 1};
            var contact3 = new Contact {Name = "Contact 3", ContactTypeId = 3};

            repository.Add(contact1);
            repository.Add(contact2);
            repository.Add(contact3);

            var items = repository.GetAll().ToList();
            items.Count().ShouldEqual(3);

            repository.Delete(contact1.ContactId, contact2.ContactId);

            items = repository.GetAll().ToList();
            items.Count().ShouldEqual(1);
            items.First().Name.ShouldEqual("Contact 3");
        }
        protected override void EstablishContext()
        {
            base.EstablishContext();

            suppliedData = GetData();
            repository = mocks.StrictMock<IRepository<StudentMetricLearningStandard>>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            Expect.Call(metricNodeResolver.ResolveMetricId(suppliedMetricId)).Return(suppliedMetricId);
            Expect.Call(repository.GetAll()).Return(suppliedData);
        }