Example #1
0
        public void AddMonthlyPackage(MonthlyPackage monthlyPackage)
        {
            if (_monthlyPackages.Contains(monthlyPackage))
            {
                throw new ArgumentException("You cannot add a duplicate MonthlyPackage.");
            }

            _monthlyPackages.Add(monthlyPackage);
        }
        public void AddMonthlyPackageMethod_DuplicateInput_ThrowsException()
        {
            var sut             = new Gym();
            var monthlyPackage1 = new MonthlyPackage {
                Id = 1535235
            };

            sut.AddMonthlyPackage(monthlyPackage1);
            sut.AddMonthlyPackage(monthlyPackage1);
        }
        public void BillForMonthlyChargeMethod_CustomerPackagePriceLessThanTenDollars_ThrowsException()
        {
            var monthlyPackage = new MonthlyPackage {
                Id = 1235, Name = "Top Fit", Price = 9.20M
            };
            var sut = new Customer {
                Id = 91352, MonthlyPackage = monthlyPackage
            };

            sut.BillForMonthlyCharge(DateTime.Today);
        }
Example #4
0
        public void NameAndPriceProperties_Set_MatchAssignedValues()
        {
            const string  name  = "Test Package";
            const decimal price = 35.00M;

            var sut = new MonthlyPackage {
                Id = 35, Name = name, Price = price
            };

            Assert.Equal(name, sut.Name);
            Assert.Equal(price, sut.Price);
        }
Example #5
0
        public void MonthlyPackageProperty_Set_PackageEqualsCustomerMonthlyPackage()
        {
            var monthlyPackage = new MonthlyPackage {
                Id = 91351
            };

            var sut = new Customer {
                MonthlyPackage = monthlyPackage
            };

            Assert.Equal(monthlyPackage, sut.MonthlyPackage);
        }
Example #6
0
        public void AddMonthlyPackageMethod_DuplicateInput_ThrowsException()
        {
            var sut             = new Gym();
            var monthlyPackage1 = new MonthlyPackage {
                Id = 1535235
            };

            sut.AddMonthlyPackage(monthlyPackage1);
            var ex = Assert.Throws <ArgumentException>(() => sut.AddMonthlyPackage(monthlyPackage1));

            Assert.Equal("You cannot add a duplicate MonthlyPackage.", ex.Message);
        }
        public void BillForMonthlyChargeMethod_CustomerIsFromOntario_ThrowsException()
        {
            var monthlyPackage = new MonthlyPackage {
                Id = 1235, Name = "Top Fit", Price = 9.20M
            };
            var address = new Address("1234 Happy St", "Toronto", "Ontario");
            var sut     = new Customer {
                Id = 91352, MonthlyPackage = monthlyPackage, Address = address
            };

            sut.BillForMonthlyCharge(DateTime.Today);
        }
Example #8
0
        public void BillForMonthlyChargeMethod_CustomerIsFromOntario_ThrowsException()
        {
            var monthlyPackage = new MonthlyPackage {
                Id = 1235, Name = "Top Fit", Price = 9.20M
            };
            var address = new Address("1234 Happy St", "Toronto", "Ontario");
            var sut     = new Customer {
                Id = 91352, MonthlyPackage = monthlyPackage, Address = address
            };
            var ex = Assert.Throws <Exception>(() => sut.BillForMonthlyCharge(DateTime.Today));

            Assert.Equal("A manual charge cannot be run for Ontario customers.", ex.Message);
        }
Example #9
0
        public void BillForMonthlyChargeMethod_CustomerPackageInput_GeneratesBatchWithTransaction()
        {
            const decimal price          = 12.20M;
            var           monthlyPackage = new MonthlyPackage {
                Id = 1235, Name = "Top Fit", Price = price
            };
            var sut = new Customer {
                Id = 91352, MonthlyPackage = monthlyPackage
            };
            var batch = sut.BillForMonthlyCharge(DateTime.Today);

            Assert.True(batch.TransactionsContainsChargeOf(price));
        }
        public void PackageNameAndPriceProperties_Getters_WrapMonthlyPackageProperties()
        {
            var monthlyPackage = new MonthlyPackage {
                Id = 91351, Name = "Top Fit", Price = 35.00M
            };

            var sut = new Customer {
                MonthlyPackage = monthlyPackage
            };

            Assert.AreEqual(sut.PackageName, monthlyPackage.Name);
            Assert.AreEqual(sut.PackagePrice, monthlyPackage.Price);
        }
Example #11
0
        public void Constructor_NoInputParams_IsInstanceOfEntityBase()
        {
            var sut = new MonthlyPackage();

            Assert.IsAssignableFrom <EntityBase>(sut);
        }
Example #12
0
        public void Constructor_NoInputParams_IsInstanceOfEntityBase()
        {
            var sut = new MonthlyPackage();

            Assert.IsInstanceOfType(typeof(EntityBase), sut);
        }