Пример #1
0
 public void AddMonthlyPackageMethod_DuplicateInput_ThrowsException()
 {
     var sut = new Gym();
     var monthlyPackage1 = new MonthlyPackage {Id = 1535235};
     sut.AddMonthlyPackage(monthlyPackage1);
     sut.AddMonthlyPackage(monthlyPackage1);
 }
Пример #2
0
 private void RejectDuplicateMonthlyPackage(MonthlyPackage monthlyPackage)
 {
     if (_monthlyPackages.Contains(monthlyPackage))
     {
         throw new ArgumentException("You cannot add a duplicate MonthlyPackage.");
     }
 }
Пример #3
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 };
     sut.BillForMonthlyCharge(DateTime.Today);
 }
Пример #4
0
        public void MonthlyPackageProperty_Set_PackageEqualsCustomerMonthlyPackage()
        {
            var monthlyPackage = new MonthlyPackage { Id = 91351 };

            var sut = new Customer {MonthlyPackage = monthlyPackage};

            Assert.AreEqual(monthlyPackage, sut.MonthlyPackage);
        }
Пример #5
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.IsTrue(batch.TransactionsContainsChargeOf(price));
 }
Пример #6
0
        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);
        }
Пример #7
0
        public void AddMonthlyPackage(MonthlyPackage monthlyPackage)
        {
            RejectDuplicateMonthlyPackage(monthlyPackage);

            _monthlyPackages.Add(monthlyPackage);
        }
Пример #8
0
 private void RejectDuplicateMonthlyPackage(MonthlyPackage monthlyPackage)
 {
     if(_monthlyPackages.Contains(monthlyPackage))
         throw new ArgumentException("You cannot add a duplicate MonthlyPackage.");
 }
Пример #9
0
        public void AddMonthlyPackage(MonthlyPackage monthlyPackage)
        {
            RejectDuplicateMonthlyPackage(monthlyPackage);

            _monthlyPackages.Add(monthlyPackage);
        }
Пример #10
0
 public void Constructor_NoInputParams_IsInstanceOfEntityBase()
 {
     var sut = new MonthlyPackage();
     Assert.IsInstanceOfType(typeof(EntityBase), sut);
 }
Пример #11
0
 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);
 }