Пример #1
0
        public void CreateUpdateReturnsUpdateDefinition()
        {
            MyDocumentUpdate update = new MyDocumentUpdate()
            {
                Field1 = "updated", Field2 = "updated", Field3 = "updated"
            };

            var updateFilter = UpdateMapper.CreateUpdate <MyDocument, MyDocumentUpdate>(update);

            Assert.IsAssignableFrom(typeof(MongoDB.Driver.UpdateDefinition <MyDocument>), updateFilter);
        }
Пример #2
0
        private void SelectForUpdate(object obj)
        {
            updateModel                            = UpdateMapper.OrganizationViewModelToOrganizationModel(this);
            kontragentModelUpdate                  = upsateRepo.FindOrgForUpdate(updateModel);
            Organization.UNPOrg                    = kontragentModelUpdate.OrgForUpdate?.UNPOrg;
            Organization.FullNameOrg               = kontragentModelUpdate.OrgForUpdate?.FullNameOrg;
            Organization.ShortNameOrg              = kontragentModelUpdate.OrgForUpdate?.ShortNameOrg;
            Organization.BrokerOpinion             = kontragentModelUpdate.OrgForUpdate?.BrokerOpinion;
            Organization.AuditorOpinion            = kontragentModelUpdate.OrgForUpdate?.AuditorOpinion;
            Organization.SectionHeadOpinion        = kontragentModelUpdate.OrgForUpdate?.SectionHeadOpinion;
            Organization.DescriptionOrg            = kontragentModelUpdate.OrgForUpdate?.DescriptionOrg;
            Organization.CreateDateOrg             = kontragentModelUpdate.OrgForUpdate.CreateDateOrg;
            Organization.SelectedCountry           = Countries.FirstOrDefault(x => x.NameCountry == kontragentModelUpdate.OrgForUpdate.CountyrOrg);
            Organization.SelectedSection           = Section.FirstOrDefault(x => x.NameSection == kontragentModelUpdate.OrgForUpdate.NameSection);
            Organization.OwnershipOrg              = kontragentModelUpdate.OrgForUpdate.OwnershipOrg;
            Organization.TaxDebt                   = kontragentModelUpdate.OrgForUpdate.TaxDebt;
            Organization.DebtsEnforcementDocuments = kontragentModelUpdate.OrgForUpdate.DebtsEnforcementDocuments;
            Organization.FalseBusiness             = kontragentModelUpdate.OrgForUpdate.FalseBusiness;
            Organization.SpecialRisc               = kontragentModelUpdate.OrgForUpdate.SpecialRisc;
            Organization.ExecuteProc               = kontragentModelUpdate.OrgForUpdate.ExecuteProc;
            Organization.BankruptcyProc            = kontragentModelUpdate.OrgForUpdate.BankruptcyProc;
            Organization.LiquidationProc           = kontragentModelUpdate.OrgForUpdate.LiquidationProc;
            Organization.BrokerClient              = kontragentModelUpdate.OrgForUpdate.BrokerClient;
            Organization.PrevBrokerClient          = kontragentModelUpdate.OrgForUpdate.PrevBrokerClient;
            Organization.Manufacturer              = kontragentModelUpdate.OrgForUpdate.Manufacturer;
            Organization.NegativData               = kontragentModelUpdate.OrgForUpdate.NegativData;
            Organization.Reputation                = kontragentModelUpdate.OrgForUpdate.Reputation;
            Organization.ExchengeTradingDisorders  = kontragentModelUpdate.OrgForUpdate.ExchengeTradingDisorders;
            Organization.SecondAccred              = kontragentModelUpdate.OrgForUpdate.SecondAccred;
            Organization.ForcedDeposite            = kontragentModelUpdate.OrgForUpdate.ForcedDeposite;
            Organization.Deposit                   = kontragentModelUpdate.OrgForUpdate.Deposit;
            Organization.RecomendDeposit           = kontragentModelUpdate.OrgForUpdate.RecomendDeposit;
            Person.DescriptionPers                 = kontragentModelUpdate.PersForUpdate?.DescriptionPers;
            Person.HeadName                        = kontragentModelUpdate.PersForUpdate?.HeadName;
            Person.OwnerName                       = kontragentModelUpdate.PersForUpdate?.OwnerName;
            Person.SelectedCountry                 = Countries.FirstOrDefault(x => x.NameCountry == kontragentModelUpdate.PersForUpdate.СountryPers);
            Person.PrevLiquidated                  = kontragentModelUpdate.PersForUpdate.PrevBankruptcy;
            Person.PrevBankruptcy                  = kontragentModelUpdate.PersForUpdate.PrevBankruptcy;
            Person.PrevStateDebt                   = kontragentModelUpdate.PersForUpdate.PrevStateDebt;
            Person.PrevTaxDebt                     = kontragentModelUpdate.PersForUpdate.PrevTaxDebt;
            Person.PrevExecuteProc                 = kontragentModelUpdate.PersForUpdate.PrevExecuteProc;
            Person.NegativDataPers                 = kontragentModelUpdate.PersForUpdate.NegativDataPers;

            Organization.RiskLevel = kontragentModelUpdate.OrgForUpdate.RiscLevel.ToString();
        }
Пример #3
0
        public void CreateUpdateWithIntegerField()
        {
            MyDocumentUpdate update = new MyDocumentUpdate()
            {
                Field1 = "updated", Field2 = "updated", Field4 = 3
            };

            var updateFilter = UpdateMapper.CreateUpdate <MyDocument3, MyDocumentUpdate>(update);

            var bson = updateFilter.Render(BsonSerializer.LookupSerializer <MyDocument3>(), BsonSerializer.SerializerRegistry);
            var json = JObject.Parse(bson.ToJson());

            var expected = new JObject()
            {
                { "$set", new JObject {
                      { "Field1", "updated" },
                      { "NewFieldName", "updated" },
                      { "Field4", 3 }
                  } }
            };

            Assert.True(JToken.DeepEquals(json, expected));
        }
Пример #4
0
        public void CreateUpdateReturnsUpdateForAllFields()
        {
            MyDocumentUpdate update = new MyDocumentUpdate()
            {
                Field1 = "updated", Field2 = "updated", Field3 = "updated"
            };

            var updateFilter = UpdateMapper.CreateUpdate <MyDocument, MyDocumentUpdate>(update);

            var bson = updateFilter.Render(BsonSerializer.LookupSerializer <MyDocument>(), BsonSerializer.SerializerRegistry);
            var json = JObject.Parse(bson.ToJson());

            var expected = new JObject()
            {
                { "$set", new JObject {
                      { "Field1", "updated" },
                      { "Field2", "updated" },
                      { "Field3", "updated" }
                  } }
            };

            Assert.True(JToken.DeepEquals(json, expected));
        }