public async Task PaymentEC_New()
        {
            var organization = await PaymentEC.NewPaymentEC();

            Assert.NotNull(organization);
            Assert.False(organization.IsValid);
        }
        public async Task PaymentEC_Get()
        {
            var organization = await PaymentEC.GetPaymentEC(BuildValidPayment());

            Assert.NotNull(organization);
            Assert.IsType <PaymentEC>(organization);
            Assert.Equal(1, organization.Id);
            Assert.True(organization.IsValid);
        }
        public async Task TestPaymentER_LastUpdatedByRequired()
        {
            var paymentType = await PaymentEC.NewPaymentEC();

            await BuildValidPaymentEC(paymentType);

            var isObjectValidInit = paymentType.IsValid;

            paymentType.LastUpdatedBy = string.Empty;

            Assert.NotNull(paymentType);
            Assert.True(isObjectValidInit);
            Assert.False(paymentType.IsValid);
            Assert.Equal("LastUpdatedBy", paymentType.BrokenRulesCollection[0].OriginProperty);
        }
        public async Task TestPaymentER_LastUpdatedByMaxLengthLessThan255()
        {
            var paymentType = await PaymentEC.NewPaymentEC();

            await BuildValidPaymentEC(paymentType);

            var isObjectValidInit = paymentType.IsValid;

            paymentType.LastUpdatedBy =
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
                "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " +
                "Duis aute irure dolor in reprehenderit";

            Assert.NotNull(paymentType);
            Assert.True(isObjectValidInit);
            Assert.False(paymentType.IsValid);
            Assert.Equal("LastUpdatedBy", paymentType.BrokenRulesCollection[0].OriginProperty);
            Assert.Equal("LastUpdatedBy can not exceed 255 characters",
                         paymentType.BrokenRulesCollection[0].Description);
        }
        private async Task BuildValidPaymentEC(PaymentEC payment)
        {
            payment.Amount = 39.99;
            payment.Person = await PersonEC.GetPersonEC(new Person()
            {
                Id = 1
            });

            payment.LastUpdatedBy         = "edm";
            payment.LastUpdatedDate       = DateTime.Now;
            payment.Notes                 = "notes here";
            payment.PaymentDate           = DateTime.Now;
            payment.PaymentExpirationDate = DateTime.Now;
            payment.PaymentSource         = await PaymentSourceEC.GetPaymentSourceEC(new PaymentSource()
            {
                Id = 1
            });

            payment.PaymentType = await PaymentTypeEC.GetPaymentTypeEC(new PaymentType()
            {
                Id = 1
            });
        }