Esempio n. 1
0
        public void LoadCustomFees(int contractId)
        {
            ContractId = contractId;

            var request = new CustomFeesRequest() { ContractId = contractId };
            var response = ContractService.GetCustomFeesForContract(request);

            gvCustomFees.DataSource = response.CustomFees;
            gvCustomFees.DataBind();

            if (response.CustomFees.Count == 0) {
                EmptyMessage.SetInformation("No Custom Fees are currently active on this Contract");
            }
            else {
                EmptyMessage.Clear();
            }
        }
Esempio n. 2
0
        public void GetAllCustomFees_returns_empty_when_contract_has_no_custom_fees()
        {
            // Arrange
            var contract = new Contract(1, _today);
            _contractRepository.Expect(c => c.GetContract(contract.Id.Value)).Returns(contract);
            _contractRepository.Expect(c => c.GetAllCustomFeesForContract(contract)).Returns(new List<CustomFee>());
            var request = new CustomFeesRequest {ContractId = contract.Id.Value};

            // Act
            var response = _service.GetCustomFeesForContract(request);

            // Assert
            Assert.IsTrue(response.IsSuccessful);
            Assert.AreEqual(0, response.CustomFees.Count);
        }
Esempio n. 3
0
        public void GetAllCustomFees_handles_missing_contract()
        {
            var contract = new Contract(1, _today);
            _contractRepository.Expect(c => c.GetContract(contract.Id.Value)).Returns<Contract>(null);
            _contractRepository.Expect(c => c.GetAllCustomFeesForContract(contract)).Returns(new List<CustomFee> { new CustomFee(123) { Description = "Test Fee", Amount = 30M, IsRecurring = false } });
            var request = new CustomFeesRequest { ContractId = contract.Id.Value };

            // Act
            var response = _service.GetCustomFeesForContract(request);

            // Assert
            Assert.IsFalse(response.IsSuccessful);
            Assert.AreEqual("Could not find Contract with Id=1", response.Message);
        }
Esempio n. 4
0
        public void GetAllCustomFees_returns_custom_fees_for_contract()
        {
            // Arrange
            var contract = new Contract(1, _today);
            _contractRepository.Expect(c => c.GetContract(contract.Id.Value)).Returns(contract);
            _contractRepository.Expect(c => c.GetAllCustomFeesForContract(contract)).Returns(new List<CustomFee> { new CustomFee(123) { Description = "Test Fee", Amount = 30M, IsRecurring = false } });
            var request = new CustomFeesRequest { ContractId = contract.Id.Value };

            // Act
            var response = _service.GetCustomFeesForContract(request);

            // Assert
            Assert.IsTrue(response.IsSuccessful);
            Assert.AreEqual(1, response.CustomFees.Count);
        }
Esempio n. 5
0
        public void GetAllCustomFees_handles_contract_repository_exception_with_internal_error_message()
        {
            var contract = new Contract(1, _today);
            _contractRepository.Expect(c => c.GetContract(contract.Id.Value)).Throws(new Exception("Fail"));
            _contractRepository.Expect(c => c.GetAllCustomFeesForContract(contract)).Returns(new List<CustomFee> { new CustomFee(123) { Description = "Test Fee", Amount = 30M, IsRecurring = false } });
            var request = new CustomFeesRequest { ContractId = contract.Id.Value };

            // Act
            var response = _service.GetCustomFeesForContract(request);

            // Assert
            Assert.IsFalse(response.IsSuccessful);
            Assert.AreEqual(Constants.Messages.INTERNAL_ERROR, response.Message);
        }