Exemple #1
0
        public void Build_SupplyAllParatmeterCorrect_ReturnsValidCirculatinBenefit()
        {
            //Arrange
            var membershipId  = Guid.NewGuid();
            var borrowPeriod  = 15;
            var noOfNrewals   = 2;
            var renewalPeriod = 10;
            var lockingPeriod = 15;

            //Act
            Circulation benefit = (Circulation)CirculationBuilder.Circulation()
                                  .ForCirculationType(CirculationType.Book)
                                  .ForMembershipType(membershipId)
                                  .CirculationsCanBeBorrowedFor(borrowPeriod)
                                  .CanBeRenewed(noOfNrewals)
                                  .EachRenewalIs(renewalPeriod)
                                  .ThenLockedFor(lockingPeriod)
                                  .Build();

            //Assert
            Assert.AreEqual(membershipId, benefit.MembershipTypeId);
            Assert.AreEqual(borrowPeriod, benefit.BorrowPeriod);
            Assert.AreEqual(noOfNrewals, benefit.NumberOfRenewals);
            Assert.AreEqual(lockingPeriod, benefit.LockingPeriod);
            Assert.AreEqual(renewalPeriod, benefit.RenewalPeriod);
        }
        public void TestMethod1()
        {
            //Arrange
            var membershipId  = Guid.NewGuid();
            var borrowPeriod  = 15;
            var noOfNrewals   = 2;
            var renewalPeriod = 10;
            var lockingPeriod = 15;

            //Act
            Circulation benefit = (Circulation)CirculationBuilder.Circulation()
                                  .ForCirculationType(CirculationType.Book)
                                  .ForMembershipType(membershipId)
                                  .CirculationsCanBeBorrowedFor(borrowPeriod)
                                  .CanBeRenewed(noOfNrewals)
                                  .EachRenewalIs(renewalPeriod)
                                  .ThenLockedFor(lockingPeriod)
                                  .Build();

            Circulation benefit2 = (Circulation)CirculationBuilder.Circulation()
                                   .ForCirculationType(CirculationType.Book)
                                   .ForMembershipType(membershipId)
                                   .CirculationsCanBeBorrowedFor(borrowPeriod)
                                   .CanBeRenewed(noOfNrewals)
                                   .EachRenewalIs(renewalPeriod)
                                   .ThenLockedFor(lockingPeriod)
                                   .Build();


            var category = MembershipCategory.Create("Category1", "Description", benefit, benefit2);

            category.IsValid();
        }
        public static BenefitBuilder CreateBenefitBuilder(BenefitType type)
        {
            switch (type)
            {
            case BenefitType.Circulation:
                return(CirculationBuilder.Circulation());

            //case BenefitType.Facility:

            //case BenefitType.TimedFacility:
            default:
                return(null);
            }
        }
Exemple #4
0
        public void Build_CirculationPeriodIsZero_ThrowInvalidBenefitException()
        {
            //Arrange
            var membershipId  = Guid.NewGuid();
            var borrowPeriod  = 15;
            var noOfNrewals   = 2;
            var renewalPeriod = 10;
            var lockingPeriod = 15;

            //Act
            Circulation benefit = (Circulation)CirculationBuilder.Circulation()
                                  .ForMembershipType(membershipId)
                                  //.CirculationsCanBeBorrowedFor(borrowPeriod)
                                  .CanBeRenewed(noOfNrewals)
                                  .EachRenewalIs(renewalPeriod)
                                  .ThenLockedFor(lockingPeriod)
                                  .Build();
            //Assert
        }