public static double PrisWeekendRabat(Bil bil)
 {
     if (bil.Dato.DayOfWeek == (DayOfWeek)6 | bil.Dato.DayOfWeek == 0)
     {
         return(bil.Pris() * 0.80);
     }
     return(bil.Pris());
 }
Example #2
0
        public double WeekendRabat(Bil testBil)
        {
            if (testBil.Dato.DayOfWeek == DayOfWeek.Saturday ||
                testBil.Dato.DayOfWeek == DayOfWeek.Sunday)
            {
                return(testBil.Pris() * 0.8);
            }


            return(testBil.Pris());
        }
        public double WeekendRabat(DateTime day)
        {
            Bil minBil = new Bil("");

            var    pris          = (double)minBil.Pris();
            double result1       = pris * 0.95;
            double WeekendsRabat = pris * 0.80;
            double result2       = WeekendsRabat * 0.95;


            if (day.DayOfWeek == DayOfWeek.Saturday || day.DayOfWeek == DayOfWeek.Sunday)
            {
                return(result2);
            }
            else
            {
                return(result1);
            }
        }
        public void SumAfTureTests()
        {
            //Arrange
            Kunde kunde = new Kunde();

            OresundBilletLibrary.Bil    oreBil   = new OresundBilletLibrary.Bil();
            StoreBaeltBilletLibrary.Bil storeBil = new StoreBaeltBilletLibrary.Bil();
            OresundBilletLibrary.MC     oreMC    = new OresundBilletLibrary.MC();
            StoreBaeltBilletLibrary.MC  storeMC  = new StoreBaeltBilletLibrary.MC();

            //Act
            kunde.Ture.Add(oreBil);
            kunde.Ture.Add(storeBil);
            kunde.Ture.Add(oreMC);
            kunde.Ture.Add(storeMC);
            decimal sum = 985; //Forventet pris af de fire ture uden nogle rabatter

            //Assert - delta er den maksimale godkendte forskel fra det forventede resultat.
            Assert.AreEqual(Convert.ToDouble(kunde.SumPrice()), Convert.ToDouble(sum), 0.001);
        }