// test exception if attempt to save in invalid state

        private async Task <PaymentER> BuildValidPaymentER()
        {
            var paymentER = await PaymentER.NewPaymentER();

            paymentER.Amount = 39.99;
            paymentER.Person = await PersonEC.GetPersonEC(new Person()
            {
                Id = 1
            });

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

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

            return(paymentER);
        }
        public async Task TestPaymentSourceEC_NewPaymentSourceEC()
        {
            var paymentSource = await PaymentSourceEC.NewPaymentSourceEC();

            Assert.NotNull(paymentSource);
            Assert.IsType <PaymentSourceEC>(paymentSource);
            Assert.False(paymentSource.IsValid);
        }
        public async Task TestPaymentSourceEC_GetPaymentSourceEC()
        {
            var paymentSourceToLoad = BuildPaymentSource();
            var paymentSource       = await PaymentSourceEC.GetPaymentSourceEC(paymentSourceToLoad);

            Assert.NotNull(paymentSource);
            Assert.IsType <PaymentSourceEC>(paymentSource);
            Assert.Equal(paymentSourceToLoad.Id, paymentSource.Id);
            Assert.Equal(paymentSourceToLoad.Description, paymentSource.Description);
            Assert.Equal(paymentSourceToLoad.Notes, paymentSource.Notes);
            Assert.Equal(paymentSourceToLoad.RowVersion, paymentSource.RowVersion);
            Assert.True(paymentSource.IsValid);
        }
        public async Task TestPaymentSourceEC_DescriptionRequired()
        {
            var paymentSourceToTest = BuildPaymentSource();
            var paymentSource       = await PaymentSourceEC.GetPaymentSourceEC(paymentSourceToTest);

            var isObjectValidInit = paymentSource.IsValid;

            paymentSource.Description = string.Empty;

            Assert.NotNull(paymentSource);
            Assert.True(isObjectValidInit);
            Assert.False(paymentSource.IsValid);
            Assert.Equal("Description", paymentSource.BrokenRulesCollection[0].Property);
        }
        public async Task TestPaymentSourceEC_DescriptionLessThan50Chars()
        {
            var paymentSourceToTest = BuildPaymentSource();
            var paymentSource       = await PaymentSourceEC.GetPaymentSourceEC(paymentSourceToTest);

            var isObjectValidInit = paymentSource.IsValid;

            paymentSource.Description =
                "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 " +
                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
                "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ";

            Assert.NotNull(paymentSource);
            Assert.True(isObjectValidInit);
            Assert.False(paymentSource.IsValid);
            Assert.Equal("Description", paymentSource.BrokenRulesCollection[0].Property);
        }
        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
            });
        }
Example #7
0
 private void BuildPaymentSource(PaymentSourceEC paymentSource)
 {
     paymentSource.Description = "doc type description";
     paymentSource.Notes       = "document type notes";
 }
 private void BuildPaymentSource(PaymentSourceEC categoryToBuild)
 {
     categoryToBuild.Description = "description for doctype";
     categoryToBuild.Notes       = "notes for doctype";
 }