コード例 #1
0
        /// TODO: Dig a little deeper into the SaveFiles method to test some more use cases...
        /// * What if a single upload fails
        /// * What if 1 of 3 fails
        /// * What if 3 of 3 fails
        /// * etc...
        private void SetUpController()
        {
            organizationRepository = new FakeOrganizationRepository();
            causeTemplateRepository = new FakeCauseTemplateRepository();
            causeRepository = new FakeCauseRepository();
            controller = new CauseTemplateController(causeTemplateRepository, causeRepository)
                             {
                                 OrganizationRepository = organizationRepository
                             };

            TestHelpers.MockBasicRequest(controller);

            organization = organizationRepository.GetDefaultOrganization();
            organization.CauseTemplates.Add(EntityHelpers.GetValidCauseTemplate());
        }
コード例 #2
0
        /// TODO: Dig a little deeper into the SaveFiles method to test some more use cases...
        /// * What if a single upload fails
        /// * What if 1 of 3 fails
        /// * What if 3 of 3 fails
        /// * etc...
        private CauseTemplateController GetController(bool isAuthenticated = false, bool postFiles = true)
        {
            organizationRepository = new FakeOrganizationRepository();
            causeTemplateRepository = new FakeCauseTemplateRepository();

            causeRepository = mocks.DynamicMock<ICauseRepository>();
            Expect.Call(causeRepository.GetCauseByCauseTemplateIdAndReferenceNumber(-1, "")).IgnoreArguments()
                .Return(EntityHelpers.GetValidCause());

            var causeTemplateController = new CauseTemplateController(causeTemplateRepository, causeRepository);
            organization = organizationRepository.GetDefaultOrganization();
            organization.CauseTemplates = new List<CauseTemplate> { EntityHelpers.GetValidCauseTemplate() };

            TestHelpers.MockHttpContext(causeTemplateController, mocks, isAuthenticated, postFiles);
            return causeTemplateController;
        }