示例#1
0
        public Result Add(string description, double amount, DateTime date, string note, PaymentType paymentType,
                          BudgetType budgetType, FundType fundType, bool?giftAid = false)
        {
            Result <Note> incomeNote = Note.Create(note);
            Result <TransactionDescription> incomeDescription = TransactionDescription.Create(description);

            var incomeGiftAid = giftAid == null ?
                                GiftAidStatus.NotSet :
                                (bool)giftAid ?
                                GiftAidStatus.GiftAid :
                                GiftAidStatus.NotGiftAid;

            var result = Result.Combine(incomeNote, incomeDescription);

            if (result.IsSuccess)
            {
                var income = Income.Create(
                    incomeDescription.Value, date, paymentType,
                    amount, budgetType, incomeNote.Value, fundType);

                Add(income);

                return(Result.Ok());
            }

            return(result);
        }
示例#2
0
        public void Setup()
        {
            income = Income.Create(
                (TransactionDescription)"Offering 20/05/18",
                DateTime.Parse("22/05/2018"),
                PaymentType.Create("CSH", "Cash").Value,
                230.00,
                BudgetType.Create("GeneralIncome", "General Income"),
                (Note)string.Empty,
                FundType.Create("Revenue", "Revenue")
                );

            income.GiftAidStatus = GiftAidStatus.NotGiftAid;
        }
        private Guid Create()
        {
            //Arrange

            Income income = Income.Create(
                DESCRIPTION,
                DATERECIEVED,
                PAYMENTTYPE,
                AMOUNT,
                BUDGETTYPE,
                NOTE,
                FUNDTYPE);

            income.GiftAidStatus = GIFTAIDSTATUS;
            income.PayingInSlip  = PAYINGINSLIP;

            //Act
            income.Id = incomeRepository.Add(income);

            //Assert
            Assert.AreNotEqual(0, income.Id, "Creating new record does not return id");

            return(income.Id);
        }