예제 #1
0
        private void Model_CanGenerateJSon()
        {
            CompensationInvestment compInv = new CompensationInvestment();

            compInv.AccountId  = "123456";
            compInv.Code       = "nu07";
            compInv.Value      = 111;
            compInv.fileKey    = Guid.NewGuid();
            compInv.ComplyDate = DateTime.UtcNow.ToString();
            //System.Diagnostics.Debugger.Launch();
            var compInvJson = compInv.GenerateJson();
        }
 public CompensationInvestment CreateCompensationParticipant(JsonObject fileMeta, JsonObject fileRule, JsonObject participant, Guid fileKey)
 {
     if (ParticipantHasInvestment(participant, fileRule["code"]))
     {
         CompensationInvestment compInvestment = new CompensationInvestment();
         compInvestment.AccountId  = GetParticipantFieldValue(participant, ACCOUNTID_KEYWORD);
         compInvestment.Value      = Decimal.Parse(GetParticipantFieldValue(participant, fileRule["code"]), new System.Globalization.CultureInfo("en-US"));
         compInvestment.Code       = fileRule["specialnumericcode"];
         compInvestment.ComplyDate = fileMeta["complianceDate"];
         compInvestment.DivCode    = "";
         compInvestment.RegCode    = "";
         compInvestment.fileKey    = fileKey;
         return(compInvestment);
     }
     return(null);
 }
        public List <CompensationInvestment> CreateCompensationInvestments(JsonObject fileMeta, JsonArray fileRules, JsonArray participants, Guid fileKey)
        {
            List <CompensationInvestment> investments = new List <CompensationInvestment>();

            foreach (JsonObject part in participants)
            {
                foreach (JsonObject rule in fileRules)
                {
                    CompensationInvestment compInv = CreateCompensationParticipant(fileMeta, rule, part, fileKey);
                    if (compInv != null)
                    {
                        investments.Add(compInv);
                        _logger.LogTrace("CreateCompensationParticipant - created: {0}", compInv);
                    }
                }
            }
            return(investments);
        }
예제 #4
0
        internal static List <CompensationInvestment> GenerateCompensationInvestments()
        {
            List <CompensationInvestment> investments = new List <CompensationInvestment>();
            Guid g = Guid.NewGuid();

            for (int i = 0; i < 5; i++)
            {
                CompensationInvestment compInvestment = new CompensationInvestment();
                compInvestment.AccountId  = "123456";
                compInvestment.Value      = 111;
                compInvestment.Code       = "nu07";
                compInvestment.ComplyDate = DateTime.UtcNow.ToString();
                compInvestment.DivCode    = "";
                compInvestment.RegCode    = "";
                compInvestment.fileKey    = g;
                investments.Add(compInvestment);
            }
            return(investments);
        }
        public void FileManager_CreateCompensationParticipant()
        {
            // we need a rule, based on rule get one participant
            //then msg contains AccountId, Value from participanr, Code from Rule

            JsonObject jobject = TestHelper.getJsonObject();

            var fm = TestHelper.getFileInfo();
            var fs = TestHelper.getCompensationRule();
            var p  = TestHelper.getParticipantObject_withCompensation();


            var objectUnderTest = new FileManager(_loggerMock.Object);

            //System.Diagnostics.Debugger.Launch();
            CompensationInvestment participant = objectUnderTest.CreateCompensationParticipant(fm, fs, p, Guid.NewGuid());

            Assert.NotNull(participant);
            Assert.True(participant.Code == "nu07");
            Assert.True(participant.AccountId == "452061756");
            Assert.True(participant.fileKey != null);
        }