Exemplo n.º 1
0
        public void BorrowerContact_Serialization()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            var borrowerContact = new BorrowerContact { AccessLevel = ContactAccessLevel.Private };
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.AreEqual(@"{""accessLevel"":0}", borrowerContact.ToString(SerializationOptions.Dirty));
            borrowerContact.Dirty = false;
            Assert.AreEqual("{}", borrowerContact.ToString(SerializationOptions.Dirty));
        }
Exemplo n.º 2
0
        public void BorrowerContact_Serialization()
        {
            var borrowerContact = new BorrowerContact {
                AccessLevel = ContactAccessLevel.Private
            };

            Assert.AreEqual(@"{""accessLevel"":0}", borrowerContact.ToJson());
            borrowerContact.Dirty = false;
            Assert.AreEqual("{}", borrowerContact.ToJson());
        }
Exemplo n.º 3
0
        public async Task BorrowerContact_CreateRetrieveAndDelete()
        {
            var client = await GetTestClientAsync();

            if (client.AccessToken.Token != "Token")
            {
                var borrowerContact = new BorrowerContact("Bob", "*****@*****.**");
                var contactId       = await client.BorrowerContacts.CreateContactAsync(borrowerContact);

                try
                {
                    Assert.IsNotNull(contactId);
                    Assert.AreEqual(contactId, borrowerContact.Id);

                    var retrievedContact = await client.BorrowerContacts.GetContactAsync(contactId);

                    Assert.IsNotNull(retrievedContact);
                    Assert.AreEqual(contactId, retrievedContact.Id);
                    Assert.AreEqual(borrowerContact.FirstName, retrievedContact.FirstName);
                    Assert.AreEqual(borrowerContact.PersonalEmail, retrievedContact.PersonalEmail);
                    Assert.IsTrue(string.IsNullOrEmpty(retrievedContact.LastName));

                    borrowerContact = new BorrowerContact(client, contactId, "Bob", "*****@*****.**")
                    {
                        LastName = "Smith"
                    };
                    await client.BorrowerContacts.UpdateContactAsync(borrowerContact);

                    retrievedContact = await client.BorrowerContacts.GetContactAsync(contactId);

                    Assert.IsNotNull(retrievedContact);
                    Assert.AreEqual(contactId, retrievedContact.Id);
                    Assert.AreEqual("Bob", retrievedContact.FirstName);
                    Assert.AreEqual("*****@*****.**", retrievedContact.PersonalEmail);
                    Assert.AreEqual("Smith", retrievedContact.LastName);
                }
                finally
                {
                    try
                    {
                        await client.BorrowerContacts.DeleteContactAsync(contactId);
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemplo n.º 4
0
        public async Task BorrowerContact_CreateRetrieveAndDelete()
        {
            var client = await GetTestClientAsync();

            if (client.AccessToken.Token != "Token")
            {
                var borrowerContact = new BorrowerContact();
                var contactId       = await client.BorrowerContacts.CreateContactAsync(borrowerContact).ConfigureAwait(false);

                Assert.IsNotNull(contactId);
                Assert.AreEqual(contactId, borrowerContact.Id);

                var retrievedContact = await client.BorrowerContacts.GetContactAsync(contactId);

                Assert.IsNotNull(retrievedContact);
                Assert.AreEqual(contactId, retrievedContact.Id);

                Assert.IsTrue(await client.BorrowerContacts.DeleteContactAsync(contactId).ConfigureAwait(false));
            }
        }