コード例 #1
0
        public void Initialise()
        {
            var container = new UnityContainer();

            this.RegisterAuthorityChecks(container);

            var claimTransaction = new BusinessComponentBuilder<ClaimTransactionHeader>();

            this.currentUser = CreateUser("CurrenUserIdentity", 1, 10);
            this.targetUser1 = CreateUser("TargetUser1Identity", 2, 10);
            this.targetUser2 = CreateUser("TargetUser2Identity", 3, 0);

            var componentMetadata = MockRepository.GenerateStub<IComponentMetadata>();
            container.RegisterInstance<IComponentMetadata>(componentMetadata);
            var product = new ProductBuilder<ProductVersion>(componentMetadata)
                            .SetProperty(a => a.GradeStructureType = GradeStructureCode) 
                            .Add(new ProductBuilder<ProductClaimDefinition>(componentMetadata)
                                .SetProperty(a => a.IsManualAuthorisationAlwaysAllowedIfNoChecksAreActive = true))
                         .Build();

            this.productClaimDefinition = product.ProductClaimDefinition;

            ObjectFactory.Instance = new ObjectFactory(container);

            var clmHeader = new BusinessComponentBuilder<ClaimHeader>()
                      .Add(new BusinessComponentBuilder<ClaimDetail>()
                      .As(out claimDetailRef)
                       .SetProperty(a => a.PolicyLinkLevel = (short)StaticValues.PolicyLinkLevel.Header)
                       .SetProperty(a => a.ProductClaimDetailID = 1)
                       .SetProperty(a => a.ClaimDetailReference = "Claim Detail Reference"))
                      .Add(new BusinessComponentBuilder<ClaimTransactionHeader>()
                        .SetProperty(a => a.IsInProgress = true)
                        .Add(new BusinessComponentBuilder<ClaimTransactionGroup>()
                            .AddRef(claimDetailRef)
                            .SetProperty(a => a.AdministerClaimMethod = 2)))
                  .Build();

            clmHeader.ClaimHeaderAnalysisCode01 = ClaimConstants.CH_ANALYSISCODE_MOTOR;

            this.claimHeader = clmHeader;
            var claimsEntities = MockRepository.GenerateStub<IClaimsQuery>();
            claimsEntities.Stub(a => a.GetClaimTransactionHeader(0)).IgnoreArguments().Return(this.claimHeader.InProgressClaimTransactionHeaders.Single());
            container.RegisterInstance<IClaimsQuery>(claimsEntities);

            this.gradesforStructure = new List<Grade> { CreateGrade(GradeCode2, 3), CreateGrade(GradeCode1, 1) };
            this.usersForGradeCode1 = new List<User> { this.currentUser, this.targetUser1 };
            this.usersForGradeCode2 = new List<User>();
            this.eventDestinations = new List<IEventDestination> { CreateEventDestination(this.targetUser1.UserIdentity, "1"), CreateEventDestination(this.targetUser1.UserIdentity, "2") };

            this.metadataEntities = MockRepository.GenerateStub<IMetadataQuery>();
            this.metadataEntities.Stub(a => a.GetUserIdByUserIdentity(this.currentUser.UserIdentity)).Return(this.currentUser.UserID);
            this.metadataEntities.Stub(a => a.GetUserGradeCode(this.currentUser.UserID, GradeStructureCode, StaticValues.GradeType.Claims)).Do(new Func<long, string, StaticValues.GradeType, string>((x, y, z) => this.userGradeCode));
            this.metadataEntities.Stub(a => a.GetGradesForGradeStructure(GradeStructureCode)).Return(this.gradesforStructure);
            this.metadataEntities.Stub(a => a.GetUsersByGradeCode(GradeCode1)).Return(this.usersForGradeCode1);
            this.metadataEntities.Stub(a => a.GetUsersByGradeCode(GradeCode2)).Return(this.usersForGradeCode2);
            container.RegisterInstance(this.metadataEntities);

            var taskService = MockRepository.GenerateStub<ITaskService>();
            taskService.Stub(a => a.GetActiveEventDestinations(null, null, DateTime.Now, DateTime.Now)).IgnoreArguments().Return(this.eventDestinations);
            taskService.Stub(a => a.GetFinishedEventDestinationByDateRange(null, null, DateTime.Now, DateTime.Now)).IgnoreArguments().Return(this.eventDestinations);
            container.RegisterInstance(taskService);


            IAXAClaimsQuery claimsQuery = MockRepository.GenerateStub<IAXAClaimsQuery>();
            claimsQuery.Stub(s => s.IsUserOutOfOffice(Arg<long>.Is.Anything, out Arg<string>.Out(String.Empty).Dummy)).Return(false);
            container.RegisterInstance<IAXAClaimsQuery>(claimsQuery);

            this.businessSupportRole = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>("BusinessSupportRole");
        }
コード例 #2
0
 public SeriesDataController(IMetadataQuery repository, CUAHSI.DataExport.IExportEngine exportEngine)
 {
     this.discoveryService = repository;
     this.wdcStore = exportEngine;
 }