public LinqValueCalculator(IDiscountHelper discountParam)
        {
            discounter = discountParam;

            System.Diagnostics.Debug.WriteLine(
                string.Format("Instance {0} created", ++counter));
        }
Exemplo n.º 2
0
        Discount_Between_10_And_100()
        {
            //arrange
            IDiscountHelper
                target = getTestObject();
            // act
            decimal
                TenDollarDiscount = target.ApplyDiscount(10);
            decimal
                HundredDollarDiscount = target.ApplyDiscount(100);
            decimal
                FiftyDollarDiscount = target.ApplyDiscount(50);

            // assert
            Assert
            .AreEqual(5, TenDollarDiscount,
                      "$10 discount is wrong"
                      );
            Assert
            .AreEqual(95, HundredDollarDiscount,
                      "$100 discount is wrong"
                      );
            Assert
            .AreEqual(45, FiftyDollarDiscount,
                      "$50 discount is wrong"
                      );
        }
        public LinqValueCalculator(IDiscountHelper discount)
        {
            this.discounter = discount;

            System.Diagnostics.Debug.WriteLine(
                string.Format("Instance {0} create", counter));
        }
Exemplo n.º 4
0
        public void Discount_Negative_Total()
        {//arrange
            IDiscountHelper target = getTestObject();

            // act
            target.ApplyDiscount(-1);
        }
Exemplo n.º 5
0
        public void Discount_negative_value()
        {
            // arrange
            IDiscountHelper target = getTestObject();

            // act
            target.ApplayDiscount(-1);
        }
Exemplo n.º 6
0
        public LinqValueCalculator(IDiscountHelper discountparam)
        {
            _discounter = discountparam;

            // for debug purposes, to count the number of instance that wgere calculated
            System.Diagnostics.Debug.WriteLine(
                string.Format("Instance {0} created", ++counter));
        }
Exemplo n.º 7
0
        [ExpectedException(typeof(ArgumentOutOfRangeException))] //assert
        public void NegativeTotalsNotAllowed()
        {
            //arrange
            IDiscountHelper target = getTestObject();

            //act
            target.ApplyDiscount(-1);
        }
Exemplo n.º 8
0
        public void Discount_Negative_Total()
        {
            // przygotowanie
            IDiscountHelper target = getTestObject();

            // działanie
            target.ApplyDiscount(-1);
        }
Exemplo n.º 9
0
 public BenefitsCalculationManager(IEmployeeRepository employeeRepository,
                                   IBenefitsRepository benefitsRepository,
                                   IDiscountHelper discountHelper)
 {
     _employeeRepository = employeeRepository;
     _benefitsRepository = benefitsRepository;
     _discountHelper     = discountHelper;
 }
Exemplo n.º 10
0
        public void Discount_Negative_Total()
        {
            // 准备
            IDiscountHelper target = getTestObject();

            // 动作
            target.ApplyDiscount(-1);
        }
Exemplo n.º 11
0
        public void Discount_Negative_Total()
        {
            // arrange (организация)
            IDiscountHelper target = getTestObject();

            // act (акт)
            target.ApplyDiscount(-1);
        }
Exemplo n.º 12
0
        public void Discount_Above_Negative_Total()
        {
            // Arrage - 시나리오 설정
            IDiscountHelper target = getTestOjbect();

            // Act - 작업 시도
            target.ApplyDiscount(-1);
        }
Exemplo n.º 13
0
        public void Discount_Above_100()
        {
            IDiscountHelper target          = getTestObject();
            decimal         total           = 200;
            var             discountedTotal = target.ApplyDiscount(total);

            Assert.AreEqual(total * 0.9M, discountedTotal);
        }
Exemplo n.º 14
0
        public void Dicsount_Negative_Total()
        {
            // Arrange (시나리오를 설정한다.)
            IDiscountHelper target = getTestObject();

            // Act (작업을 시도한다.)
            target.ApplyDiscount(-1);
        }
Exemplo n.º 15
0
        public WebStoreService()
        {
            IKernel          standartKernel = new StandardKernel();
            NinjectDepKernel ndr            = new NinjectDepKernel(standartKernel);
            IKernel          ninjectKernel  = ndr.GetKernel();

            m_dbe = ninjectKernel.Get <Services.Services.Base.IDataBaseEngine>();
            m_dh  = ninjectKernel.Get <IDiscountHelper>();
        }
Exemplo n.º 16
0
        [ExpectedException(typeof(ArgumentOutOfRangeException))]//утверждение, которое будет выполнено только в том случае, если модульный тест выбросит исключение типа, указанного параметром ExceptionType.Это аккуратный способ ловить исключения без необходимости возиться с блоками try...catch в юнит тесте.
        public void Discount_Negative_Total()
        {
            //ARRANGE
            IDiscountHelper target = getTestObject();

            //ACT
            target.ApplyDiscount(-1);
            //ASSERT
        }
Exemplo n.º 17
0
        public void Discount_Less_Than_10()
        {
            IDiscountHelper target             = getTestObject();
            decimal         FiveDollarDiscount = target.ApplyDiscount(5);
            decimal         ZoreDollarDiscount = target.ApplyDiscount(0);

            Assert.AreEqual(5, FiveDollarDiscount);
            Assert.AreEqual(0, ZoreDollarDiscount);
        }
Exemplo n.º 18
0
        public void Discount_Less_Than_10()
        {
            IDiscountHelper target    = GetTestObject();
            decimal         discount5 = target.ApplyDiscount(5);
            decimal         discount0 = target.ApplyDiscount(0);

            Assert.AreEqual(5, discount5);
            Assert.AreEqual(0, discount0);
        }
        public void ApplyDiscount_PriceBelow10_NoDiscount()
        {
            IDiscountHelper discountHelper = GetTestObject();

            var DiscountFor7 = discountHelper.ApplyDiscount(7);
            var DiscountFor0 = discountHelper.ApplyDiscount(0);

            Assert.AreEqual(7, DiscountFor7, "Discount for $7 is wrong");
            Assert.AreEqual(0, DiscountFor0, "Discount for $0 is wrong");
        }
Exemplo n.º 20
0
        public void Discount_Above_100()
        {// arranged , get test object
            IDiscountHelper target = getTestObject();
            decimal         total  = 200;
            // action
            var discountedTotal = target.ApplyDiscount(total);

            // assert
            Assert.AreEqual(total * 0.9M, discountedTotal);
        }
Exemplo n.º 21
0
        public void Discount_Above_100()
        {
            // Arrange
            IDiscountHelper target = getTestObject();
            decimal         total  = 200;
            // Act
            var discountTotal = target.ApplyDiscount(total);

            // Assert
            Assert.AreEqual(total * 0.9M, discountTotal);
        }
Exemplo n.º 22
0
        [TestMethod]//отдельными юнит тестами являются методы
        public void Discount_Above_100()
        {
            // PART ARRANGE !!!
            IDiscountHelper target = getTestObject(); //getTestObject создает экземпляр объекта который собираемся тестировать:MinimumDiscountHelper
            decimal         total  = 200;
            // PART ACT!!! вызываем метод MinimumDiscountHelper.ApplyDiscount и присваиваем результат переменной discountedTotal
            var discountedTotal = target.ApplyDiscount(total);

            // PART ASSERT !!!
            Assert.AreEqual(total * 0.9M, discountedTotal);//метод Assert.AreEqual, для проверки, значения, которые мы получили от метода ApplyDiscount, составляет 90% от первоначальной общей стоимости
        }
Exemplo n.º 23
0
        public void TestMethod1()
        {
            //Arrange
            IDiscountHelper taget = getTestOBJ();
            Decimal         total = 200;
            //act
            var discountTotal = taget.ApplyDiscount(total);

            //assert
            Assert.AreEqual(total * 0.9M, discountTotal);
        }
Exemplo n.º 24
0
        public void Ten_Percent_Default_Discount()
        {
            // arrange
            IDiscountHelper target = getTestObject();
            decimal         total  = 200;
            // act
            var discountedTotal = target.ApplyDiscount(total);

            // assert
            Assert.AreEqual(180, discountedTotal);
        }
Exemplo n.º 25
0
        /// <summary>
        /// We need to supply our DiscountHelper with discounts from the database before all computed properties will work
        /// </summary>
        /// <param name="discounts"></param>
        public void ApplyDiscounts(IDiscountHelper discountHelper)
        {
            DiscountHelper = discountHelper;
            var dependents = EmployeeDependents.Select(d => d.Dependent).ToList();

            foreach (var dependent in dependents)
            {
                dependent.ApplyDiscounts(discountHelper);
                ProccessedDependents.Add(dependent);
            }
        }
Exemplo n.º 26
0
        public void Discount_Between_10_and_100()
        {
            IDiscountHelper target                = getTestObject();
            decimal         TenDollarDiscount     = target.ApplyDiscount(10);
            decimal         HundredDollarDiscount = target.ApplyDiscount(100);
            decimal         FiftyDollarDiscount   = target.ApplyDiscount(50);

            Assert.AreEqual(5, TenDollarDiscount, "rabat w wysokości 10 zł jest nieprawidłowy");
            Assert.AreEqual(95, HundredDollarDiscount, "rabat w wysokości 100 zł jest nieprawidłowy");
            Assert.AreEqual(45, FiftyDollarDiscount, "rabat w wysokości 50 zł jest nieprawidłowy");
        }
Exemplo n.º 27
0
        public void DiscountBetween10And100()
        {
            IDiscountHelper target                = getTestObject();
            decimal         TenDollarDiscount     = target.ApplyDiscount(10);
            decimal         HundredDollarDiscount = target.ApplyDiscount(100);
            decimal         FiftDollarDiscount    = target.ApplyDiscount(50);

            Assert.AreEqual(5, TenDollarDiscount, "$10 discount is wrong");
            Assert.AreEqual(95, HundredDollarDiscount, "$100 discount is wrong");
            Assert.AreEqual(45, FiftDollarDiscount, "$50 discount is wrong");
        }
Exemplo n.º 28
0
        public void Discount_Less_Than_10()
        {
            IDiscountHelper target = getTestObject();

            decimal Five = target.ApplyDiscount(5);
            decimal Zero = target.ApplyDiscount(0);


            Assert.AreEqual(5, Five);
            Assert.AreEqual(0, Zero);
        }
Exemplo n.º 29
0
        public void Discount_less_Than_10()
        {
            //arrange
            IDiscountHelper target = getTestObject();
            //act
            decimal discount5 = target.ApplyDiscount(5);
            decimal discount0 = target.ApplyDiscount(0);

            Assert.AreEqual(5, discount5);
            Assert.AreEqual(0, discount0);
        }
Exemplo n.º 30
0
        public void Discount_Between_10_And_100()
        {
            IDiscountHelper target       = getTestOBJ();
            decimal         Tendollar    = target.ApplyDiscount(10);
            decimal         hundredollar = target.ApplyDiscount(100);
            decimal         Fiftydollar  = target.ApplyDiscount(50);

            Assert.AreEqual(5, Tendollar, "10달러 아님");
            Assert.AreEqual(95, hundredollar, "100달러 아님");
            Assert.AreEqual(45, Fiftydollar, "50달러 아님");
        }
 public LinqValueCalculator(IDiscountHelper discounterParam) 
 {
     this.discounter = discounterParam;
     Debug.WriteLine("Instance {0} created", ++instanceNumber);
 }
 public LinqValueCalculator(IDiscountHelper discounter)
 {
     this.discounter = discounter;
 }
 public LinqValueCalculator(IDiscountHelper discountParam) {
     discounter = discountParam;
     System.Diagnostics.Debug.WriteLine(string.Format("Instance {0} created", ++counter));
 }
Exemplo n.º 34
0
 public LinqValueCalculator(IDiscountHelper discountParam)
 {
     discounter = discountParam;
 }
 public LinqValueCalculator(IDiscountHelper discounter)
 {
     _discounter = discounter;
     // throw new NotImplementedException();
 }
 public IterativeValueCalculator(IDiscountHelper discountParam)
 {
     discounter = discountParam;
 }
 public LinqValueCalculator(IDiscountHelper discountParam)
 {
     discounter = discountParam;
     System.Diagnostics.Debug.WriteLine($"Utworzono egzemplarz {++counter}");
 }
 public LinqValueCalculatorService(IDiscountHelper discounter)
 {
     _discounter = discounter;
 }
Exemplo n.º 39
0
 public MyValueCalculator(IDiscountHelper a)
 {
     discounter = a;
 }
Exemplo n.º 40
0
 public LinqValueCalculator(IDiscountHelper helper)
 {
     discountHelper = helper;
 }