Inheritance: EntityBase
示例#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);
        }
 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);
 }