Exemple #1
0
        private CreateRecordRequest.IBuilderWithResource InitCreateResourceRequest(int resourceNumber, Func <Enums.ResourceType, IEnumerable <string> > getFieldList)
        {
            Dictionary <Enums.ResourceType, ulong> phaseList = new Dictionary <Enums.ResourceType, ulong>();

            foreach (var resourceType in Enum.GetValues(typeof(Enums.ResourceType)))
            {
                if ((Enums.ResourceType)resourceType != Enums.ResourceType.Contract)
                {
                    phaseList[(Enums.ResourceType)resourceType] =
                        ulong.Parse(OptionFieldHelper.GetOptionItem(OptionFieldHelper.GetOptionList($"Option.P_{((Enums.ResourceType)resourceType).ToResourceName()}Phase").First()).Id);
                }
            }

            CreateRecordRequest.IBuilder result = ResourceRequest.CreateRecords();
            foreach (var symbolType in Enum.GetValues(typeof(SameResultSymbolType)))
            {
                foreach (var resourceType in Enum.GetValues(typeof(Enums.ResourceType)))
                {
                    result.Append(((Enums.ResourceType)resourceType).ToPrivateEnum(),
                                  content =>
                    {
                        AppendCommonContent(content, (SameResultSymbolType)symbolType, (Enums.ResourceType)resourceType, phaseList);
                        foreach (var field in CommonConstant.NoneTelephoneTextField[(Enums.ResourceType)resourceType])
                        {
                            content.Append(field, KeywordHelper.GetFieldValueBasedOnSymbolType(field, (SameResultSymbolType)symbolType, GetSymbolIndex((SameResultSymbolType)symbolType)));
                        }
                        foreach (var field in CommonConstant.ApplicationNoneTelephoneTextField)
                        {
                            content.Append(field, KeywordHelper.GetFieldValueBasedOnSymbolType(field, (SameResultSymbolType)symbolType, GetSymbolIndex((SameResultSymbolType)symbolType)));
                        }
                    }, $"{resourceType}{symbolType}");
                }
            }
            return(result as CreateRecordRequest.IBuilderWithResource);
        }
        public void TestCreatePhaseFlow()
        {
            Option option = OptionFieldHelper.GetOptionItem("Option.P_ClientPhase");
            ulong  optionClientPhaseId = ulong.Parse(option.Id);
            ulong  clientPhaseId       = phaseFlowCreator.Data.Single();

            Assert.That(clientPhaseId, Is.EqualTo(optionClientPhaseId), "Phase is not match");
        }
Exemple #3
0
        public void TestReadPhaseFlow()
        {
            Option option = OptionFieldHelper.GetOptionItem("Option.P_ClientPhase");
            int    optionClientPhaseId = int.Parse(option.Id);
            int    clientPhaseId       = phaseFlowReader.Data.Where(dic => dic.Value.Depth == "1").Single().Key;

            Assert.That(clientPhaseId, Is.EqualTo(optionClientPhaseId), "Phase is not match");
            Assert.That(phaseFlowReader.Data.Values.Where(val => val.Depth == "1").Single().FlowItems, Is.Not.Null, "The flow rule is null");
            Assert.That(phaseFlowReader.Data.Values.Where(val => val.Depth == "1").Single().FlowItems.Count, Is.GreaterThan(0), "The flow rule is emtpy");
        }
Exemple #4
0
 /// <summary>
 /// Get last option phase id
 /// </summary>
 /// <param name="resourceType">Resource type</param>
 /// <param name="index">Index of phase list</param>
 /// <returns>Option list</returns>
 public static ulong GetLastPhaseOptionId(Enums.ResourceType resourceType, int index = 0)
 {
     if (index != 0)
     {
         return(ulong.Parse(OptionFieldHelper.GetOptionItem(OptionFieldHelper.GetOptionList(phaseOption[resourceType])[index]).Id));
     }
     else
     {
         return(ulong.Parse(OptionFieldHelper.GetOptionItem(OptionFieldHelper.GetOptionList(phaseOption[resourceType]).Last()).Id));
     }
 }
        /// <summary>
        /// Create an instance of CreateRecordRequest.IBuilderWithResource that creates all type of Resources with list of field inputs.
        /// Use $"{ResourceId}{index}" to get the proper record.
        /// </summary>
        /// <param name="resourceNumber">Number of records created</param>
        /// <param name="testCaseData">Dictionary of test case data</param>
        /// <param name="fieldsName">List of field name</param>
        /// <returns>CreateRecordRequest.IBuilderWithResource</returns>
        public static CreateRecordRequest.IBuilderWithResource InitCreateAllResourceRequestWithField(HrbcFieldCreator customField, string[] applicationField)
        {
            CreateRecordRequest.IBuilder result = ResourceRequest.CreateRecords();
            List <string> processPhases         = OptionFieldHelper.GetOptionList(Enums.Options.ProcessPhase);
            Option        option   = OptionFieldHelper.GetOptionItem(processPhases.First());
            ulong         optionId = ulong.Parse(option.Id);

            foreach (var resourceType in Enum.GetValues(typeof(Enums.ResourceType)).Cast <Enums.ResourceType>())
            {
                result.Append(resourceType.ToPrivateEnum(),
                              content => PrepareContent(content, resourceType, customField, applicationField),
                              $"{resourceType.ToPrivateEnum()}");
            }

            return(result as CreateRecordRequest.IBuilderWithResource);
        }
Exemple #6
0
        public TestSingleSearchField()
        {
            conditionValues = new Dictionary <string, object>()
            {
                [nameof(PhaseApiFields.Resource)] = ((int)defaultResource).ToString(),
                [PhaseApiFields.Phase]            = OptionFieldHelper.GetOptionItem(OptionFieldHelper.GetOptionList($"Option.P_{defaultResource.ToResourceName()}Phase").First()).Id,
                [PhaseApiFields.Date]             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                [PhaseApiFields.Memo]             = "Memo",
                [PhaseApiFields.Recent]           = "1",
                [PhaseApiFields.RegisteredBy]     = "1",
                [PhaseApiFields.UpdatedBy]        = "1",
                [PhaseApiFields.UpdateDate]       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                [PhaseApiFields.RegistrationDate] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            };

            //Create 4 phase entries more
            PhaseHelper.CreatePhaseWithGenerateSystemDateTimeField();

            //Create 3 phase entries more by private. Make sure that we have multiple phase entry to search correctly
            recordUpdater1 = new HrbcRecordUpdater(() => PhaseHelper.InitRecordsUpdater(records, defaultResource, num, 1)); //Update phase in middle. Note: should choose resource type more than 3 option phases
            recordUpdater2 = new HrbcRecordUpdater(() => PhaseHelper.InitRecordsUpdater(records, defaultResource, num, 2));
            recordUpdater3 = new HrbcRecordUpdater(() => PhaseHelper.InitRecordsUpdater(records, defaultResource, num, 3));
        }
        /// <summary>
        /// Append common content for creating resource request.
        /// All keyword text field will not be added
        /// </summary>
        /// <param name="content"></param>
        /// <param name="symbolType"></param>
        /// <param name="resourceType"></param>
        public static void AppendCommonContent(CreateRecordRequest.IContentBuilder content, SameResultSymbolType symbolType, Enums.ResourceType resourceType)
        {
            switch (resourceType)
            {
            case Enums.ResourceType.Client:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Name", "Test Client");
                break;

            case Enums.ResourceType.Recruiter:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Name", "Test Recruiter")
                .Append("P_Client", new CreateRecordRequest.Reference($"{Enums.ResourceType.Client}{symbolType}"));
                break;

            case Enums.ResourceType.Job:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Position", "Test Job")
                .Append("P_Client", new CreateRecordRequest.Reference($"{Enums.ResourceType.Client}{symbolType}"))
                .Append("P_Recruiter", new CreateRecordRequest.Reference($"{Enums.ResourceType.Recruiter}{symbolType}"));
                break;

            case Enums.ResourceType.Candidate:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Name", "Test Person");
                break;

            case Enums.ResourceType.Resume:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Candidate", new CreateRecordRequest.Reference($"{Enums.ResourceType.Candidate}{symbolType}"));
                break;

            case Enums.ResourceType.Process:
                List <string> processPhases = OptionFieldHelper.GetOptionList(Enums.Options.ProcessPhase);
                Option        option        = OptionFieldHelper.GetOptionItem(processPhases.First());
                ulong         optionId      = ulong.Parse(option.Id);
                content
                .Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Client", new CreateRecordRequest.Reference($"{Enums.ResourceType.Client}{symbolType}"))
                .Append("P_Recruiter", new CreateRecordRequest.Reference($"{Enums.ResourceType.Recruiter}{symbolType}"))
                .Append("P_Job", new CreateRecordRequest.Reference($"{Enums.ResourceType.Job}{symbolType}"))
                .Append("P_Candidate", new CreateRecordRequest.Reference($"{Enums.ResourceType.Candidate}{symbolType}"))
                .Append("P_Resume", new CreateRecordRequest.Reference($"{Enums.ResourceType.Resume}{symbolType}"))
                .Append("P_Phase", optionId);
                break;

            case Enums.ResourceType.Sales:
                content.Append("P_Owner", ResourceHelper.DefaultUser);
                break;

            case Enums.ResourceType.Activity:
                content.Append("P_Owner", ResourceHelper.DefaultUser)
                .Append("P_Title", "Test Activity")
                .Append("P_FromDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                break;

            case Enums.ResourceType.Contract:
                content.Append("P_Client", new CreateRecordRequest.Reference($"{Enums.ResourceType.Client}{symbolType}"))
                .Append("P_Name", "Test Contract");
                break;
            }
        }