Example #1
0
        public void ShouldValidateQualityUpperLimit()
        {
            // arrange
            Aged itemz = new Aged(50);

            // act
            itemz.AdjustQuality();

            //assert
            itemz.CurrentQuality().Should().Be(50);
        }
Example #2
0
        public void ShouldValidateIsAgedItemsIncrement()
        {
            // arrange
            Aged itemz = new Aged(49);

            // act
            itemz.AdjustQuality();

            //assert
            itemz.CurrentQuality().Should().Be(50);
        }
        public void AgedCheeseShouldExpire()
        {
            Utils.ReceivedDate = new DateTime(2021, 02, 15);
            var    currentDate = Utils.ReceivedDate;
            Cheese cheese      = new Aged("Roquefort", "2021-02-20", "3", 14.25, CheeseType.Name.Aged, Utils.ReceivedDate);

            for (int i = 0; i <= 4; i++)
            {
                cheese.SetPrice(cheese, currentDate);
                currentDate = currentDate.AddDays(1);
            }

            Assert.True(cheese.IsExpired(currentDate));
        }
        public void AgedCheesePriceShouldIncrease()
        {
            Utils.ReceivedDate = new DateTime(2021, 02, 15);
            var    currentDate = Utils.ReceivedDate;
            Cheese cheese      = new Aged("Roquefort", "2021-02-20", "8", 14.25, CheeseType.Name.Aged, Utils.ReceivedDate);

            for (int i = 0; i < 3; i++)
            {
                cheese.SetPrice(cheese, currentDate);
                currentDate = currentDate.AddDays(1);
            }

            Assert.Equal(16.50, PriceFormatter.ShowPriceAsDecimal(cheese.Price));
        }
Example #5
0
 public static bool DeleteAged(int ageId)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Aged st     = Aged.FindById(ageId);
             st.IsDelete = true;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
Example #6
0
 public static bool AddAgedNull(int people_Id)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Aged st      = new Aged();
             st.People_Id = people_Id;
             st.IsDelete  = false;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
Example #7
0
 public static bool UpdateAgedByPeople(int people_Id, string health, string tendance, string relationship, string phone, string type)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Aged st         = Aged.FindOne(CK.K["People_Id"] == people_Id && CK.K["IsDelete"] == false);
             st.Health       = health;
             st.Tendance     = tendance;
             st.Relationship = relationship;
             st.Phone        = phone;
             st.Type         = type;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
Example #8
0
 public static bool UpdateAged(int ageId, string health, string tendance, string relationship, string phone, string type)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Aged st         = Aged.FindById(ageId);
             st.Health       = health;
             st.Tendance     = tendance;
             st.Relationship = relationship;
             st.Phone        = phone;
             st.Type         = type;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }
Example #9
0
 public static bool AddAged(int people_Id, string health, string tendance, string relationship, string phone, string type)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             Aged st         = new Aged();
             st.People_Id    = people_Id;
             st.Health       = health;
             st.Tendance     = tendance;
             st.Relationship = relationship;
             st.Phone        = phone;
             st.Type         = type;
             st.IsDelete     = false;
             st.Save();
         });
     }
     catch { return(false); }
     return(true);
 }