Esempio n. 1
0
        public void TC1_Divide9by0()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvActualUSDValue();
            ICalculator calc1 = new calc(feed);

            Assert.That(() => calc1.Divide(9, 0), Throws.TypeOf <DivideByZeroException>());
        }
Esempio n. 2
0
        public void TC1_Divide9by3()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvActualUSDValue();
            ICalculator calc1 = new calc(feed);
            int         res   = calc1.Divide(9, 3);

            Assert.AreEqual(3, res);
        }
Esempio n. 3
0
        public void TC3_ConvertUSDtoCLPTest()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvGetMockExchangeRateFeed();
            ICalculator calculator         = new Calculator(feed);
            int         actualResult       = calculator.ConvertUSDtoCLP(1);
            int         expectedResult     = 500;

            Assert.AreEqual(expectedResult, actualResult);
        }
Esempio n. 4
0
        public void TC1_Divide9By3()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvGetMockExchangeRateFeed();
            ICalculator calculator         = new Calculator(feed);
            int         actualResult       = calculator.Divide(9, 3);
            int         expectedResult     = 3;

            Assert.AreEqual(expectedResult, actualResult);
        }
Esempio n. 5
0
        //[ExpectedException(typeof(System.DivideByZeroException))]
        public void TC2_DivideByZero()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvGetMockExchangeRateFeed();
            ICalculator calculator         = new Calculator(feed);

            //int actualResult = calculator.Divide(9, 0);
            //int actualResult =
            Assert.Throws <DivideByZeroException>(() => calculator.Divide(9, 0));
        }
Esempio n. 6
0
        public void TC3_ConvertUSDtoCLPTest()
        {
            IUSD_CLP_ExchangeRateFeed feed = this.prvGetMockExchangeRateFeed();
            ICalculator calculator         = new Calculator(feed);
            int         actualResult       = calculator.ConvertUSDtoCLP(1);
            int         expectedResult     = 500;

            Assert.AreEqual(expectedResult, actualResult);

            //https://www.codeproject.com/Articles/796014/KickStart-your-Unit-Testing-using-Moq
            //To verify that a method was called, use the Verify method on the mock object;

            //mockCustomerRepository.Verify(t => t.Add(It.IsAny<Customer>()));
        }
Esempio n. 7
0
 public Calculator(IUSD_CLP_ExchangeRateFeed feed)
 {
     this._feed = feed;
 }
Esempio n. 8
0
 public void TC2_DivideByZero()
 {
     IUSD_CLP_ExchangeRateFeed feed = this.prvGetMockExchangeRateFeed();
     ICalculator calculator         = new Calculator(feed);
     int         actualResult       = calculator.Divide(9, 0);
 }
Esempio n. 9
0
 public calc(IUSD_CLP_ExchangeRateFeed feed)
 {          //constructor
     this._feed = feed;
 }