Example #1
0
        public void Income_Copy()
        {
            var first = new Income
            {
                Amount = 120,
                Category = new IncomeCategory
                {
                    Id = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date = DateTime.Today,
                Id = 0,
                Method = new PaymentMethod
                {
                    Id = 0,
                    Name = "Method"
                }
            };

            var second = first.Copy();

            Assert.AreNotSame(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
Example #2
0
        public void Income_Copy()
        {
            var first = new Income
            {
                Amount   = 120,
                Category = new IncomeCategory
                {
                    Id   = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date     = DateTime.Today,
                Id       = 0,
                Method   = new PaymentMethod
                {
                    Id   = 0,
                    Name = "Method"
                }
            };

            var second = first.Copy();

            Assert.AreNotSame(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
Example #3
0
        public void IncomeExpense_TestEquality()
        {
            Income  income = new Income(1, DateTime.Today, "test");
            Expense ex     = new Expense(1, DateTime.Today, "test");

            Assert.IsFalse(income.Equals(ex));
        }
Example #4
0
        public void Income_TestEquality()
        {
            Income income  = new Income(1, DateTime.Today, "test");
            Income income2 = new Income(1, DateTime.Today, "test");

            Assert.IsTrue(income.Equals(income2));
        }
Example #5
0
        /// <summary>
        ///     Saves the current state of the income -if it is different than the original state
        ///     -closes the form after the save
        /// </summary>
        /// <param name="sender">Standard sender object</param>
        /// <param name="e">Standard event object</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!currentIncome.Equals(originalIncome))
            {
                _incomeService.Save(currentIncome);

                Close();
            }
        }
Example #6
0
        public void Equals_WhenDifferent_MustReturn_False()
        {
            var      now = DateTime.Now;
            Movement a   = new Expense(1, now, "libri");
            Movement b   = new Expense(2, now, "libri");

            Movement c = new Income(1, now, "libri");
            Movement d = new Income(2, now, "libri");

            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(c.Equals(d));
        }
Example #7
0
        public void Equals_Category_Differs()
        {
            var first = new Income
            {
                Amount   = 120,
                Category = new IncomeCategory
                {
                    Id   = 0,
                    Name = "Other_Category"
                },
                Comments = "Stuff",
                Date     = DateTime.Today,
                Id       = 0,
                Method   = new PaymentMethod
                {
                    Id   = 0,
                    Name = "Method"
                }
            };

            var second = new Income
            {
                Amount   = 120,
                Category = new IncomeCategory
                {
                    Id   = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date     = DateTime.Today,
                Id       = 0,
                Method   = new PaymentMethod
                {
                    Id   = 0,
                    Name = "Method"
                }
            };

            Assert.AreNotSame(first, second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
        }
Example #8
0
        public void Equals_Method_Differs()
        {
            var first = new Income
            {
                Amount = 120,
                Category = new IncomeCategory
                {
                    Id = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date = DateTime.Today,
                Id = 0,
                Method = new PaymentMethod
                {
                    Id = 0,
                    Name = "Other_Method"
                }
            };

            var second = new Income
            {
                Amount = 120,
                Category = new IncomeCategory
                {
                    Id = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date = DateTime.Today,
                Id = 0,
                Method = new PaymentMethod
                {
                    Id = 0,
                    Name = "Method"
                }
            };

            Assert.AreNotSame(first, second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
        }