Exemplo n.º 1
0
        private Document CreateSimpleDoument()
        {
            var counterPartyLogic = new CounterPartyLogic(_jsonLogic);
            var cityLogic         = new CityLogic(_jsonLogic);

            var senderCityRef = cityLogic.GetCityByName("Одесса").Ref;
            var senderRef     = counterPartyLogic.GetSenderCounterpartyRef();
            var senderContact = counterPartyLogic.GetCounterpartyFirstContactWithEmail(senderRef).Ref;

            var recipientCityRef   = cityLogic.GetCityByName("Киев").Ref;
            var recipientPhone     = "0934502712";
            var recipientFirstName = "Вася";
            var recipientLastName  = "Пупкин";

            var recipient = counterPartyLogic.CreateConterparty(new CounterParty()
            {
                FirstName            = recipientFirstName,
                LastName             = recipientLastName,
                Phone                = recipientPhone,
                CityRef              = recipientCityRef,
                CounterpartyType     = "PrivatePerson",
                CounterpartyProperty = "Recipient"
            });

            var document = new Document()
            {
                Ref              = null,
                SendersPhone     = "380934502711",
                CitySender       = senderCityRef,
                ContactSender    = senderContact,
                ServiceType      = "WarehouseDoors",
                PayerType        = "Sender",
                PaymentMethod    = "Cash",
                DateTime         = DateTime.Now,
                CargoType        = "Cargo",
                SeatsAmount      = 1,
                Weight           = 0.3,
                VolumeGeneral    = 0.001,
                Description      = "аксесуари до мобільних пристроїв",
                Cost             = 123,
                Sender           = senderRef.Value,
                SenderAddress    = new Guid("5A39E590-E1C2-11E3-8C4A-0050568002CF"),
                CityRecipient    = recipientCityRef,
                Recipient        = recipient.Ref.Value,
                RecipientAddress = new Guid("7B422FA4-E1B8-11E3-8C4A-0050568002CF"),
                ContactRecipient = recipient.ContactPerson.data[0].Ref.Value,
                RecipientsPhone  = recipientPhone
            };

            return(document);
        }
Exemplo n.º 2
0
        public void CreateCounterPartyTest()
        {
            var cl     = new CounterPartyLogic(_jsonLogic);
            var result = cl.CreateConterparty(new CounterParty()
            {
                CityRef              = new Guid("db5c88d7-391c-11dd-90d9-001a92567626"),
                FirstName            = "Фелікс",
                MiddleName           = "Едуардович",
                LastName             = "Яковлєв",
                Phone                = "0997979789",
                Email                = "",
                CounterpartyType     = "PrivatePerson",
                CounterpartyProperty = "Recipient"
            });

            Assert.AreEqual(result.FirstName, "Фелікс");
        }