Example #1
0
 public void CallConstructor_WithCommissionLessThen0_ThrowsArgumentException()
 {
     //Arrange
     //Act
     //Assert
     var broker = new DigiCoinBroker(-1, 1);
 }
Example #2
0
 public void CallConstructor_WithQuoteLessThen0_ThrowsArgumentException()
 {
     //Arrange
     //Act
     //Assert
     var broker = new DigiCoinBroker(new List <CommissionEntry>(), -1);
 }
Example #3
0
 public void CallConstructor_WithNullCommissionArray_ThrowsArgumentNullException()
 {
     //Arrange
     //Act
     //Assert
     var broker = new DigiCoinBroker(null, 1);
 }
Example #4
0
        public void CommissionSetToSomeNumber_ReturnsTheCommission()
        {
            //arrange
            const decimal expected = 0.03m;
            var           broker   = new DigiCoinBroker(expected, 1.44m);
            //act
            var result = broker.GetCommission(20);

            //asset
            Assert.AreEqual(expected, result);
        }
Example #5
0
        public void OrderNot10Multiplication_ThrowsException()
        {
            //Arrange
            var broker = new DigiCoinBroker(new List <CommissionEntry> {
                null, null
            }, 1);

            //Act
            //Assert
            broker.GetCommission(9);
        }
Example #6
0
        public void OrderMoreThen100_ThrowsException()
        {
            //Arrange
            var broker = new DigiCoinBroker(new List <CommissionEntry> {
                null, null
            }, 1);

            //Act
            //Assert
            broker.GetCommission(110);
        }
Example #7
0
        public void BrokerWithCommissionListOfNull_ThrowsException()
        {
            //Arrange
            var broker = new DigiCoinBroker(new List <CommissionEntry> {
                null, null
            }, 1);

            //Act
            //Assert
            broker.GetCommission(10);
        }
Example #8
0
        public void BrokerWithSomeSettings_GetQuote_ReturnsProperQuote()
        {
            //Arrange
            const decimal expected = 62.58m;
            var           broker   = new DigiCoinBroker(0.05m, 1.49m);
            //Act
            var result = broker.GetQuoteForTransaction(40);

            //Assert
            Assert.AreEqual(expected, result);
        }
Example #9
0
        public void BrokererTransacted2Orderd_With40And50Coins_Reports90()
        {
            //Arrange
            const int expected = 90;
            var       broker   = new DigiCoinBroker(0.05m, 1.49m);

            //Act
            broker.TakeOrder(40);
            broker.TakeOrder(50);

            var result = broker.ReportTransactedNumber();

            //Assert
            Assert.AreEqual(expected, result);
        }
Example #10
0
        public void CommissionSetArray1_ReturnsTheCommission3()
        {
            //arrange
            const decimal expected        = 0.03m;
            var           commissionTable = new List <CommissionEntry>
            {
                new CommissionEntry(20, 1.3m),
                new CommissionEntry(100, 1.35m),
                new CommissionEntry(60, expected),
            };
            var broker = new DigiCoinBroker(commissionTable, 1.44m);
            //act
            var result = broker.GetCommission(50);

            //asset
            Assert.AreEqual(expected, result);
        }