예제 #1
0
        public void GetUnInvoicedCalls_for_contract_with_no_calls_returns_empty_list()
        {
            // check contract exists
            _contractRepository
                .Expect(c => c.GetContract(1))
                .Returns(new Contract(1, DateTime.Now));

            // return some calls for the contract
            _contractRepository
                .Expect(c => c.GetNonInvoicedCallsByContractId(1))
                .Returns(new List<Call>());

            var request = new GetUnInvoicedCallsRequest { ContractId = 1, User = CreateIUser() };
            var response = _service.GetUnInvoicedCalls(request);
            Assert.IsTrue(response.IsSuccessful, "Successful");
            Assert.IsTrue(response.UninvoicedCalls.Count == 0, "Count");
        }
예제 #2
0
        public void GetUnInvoicedCalls_for_non_existent_contract_returns_not_found()
        {
            _contractRepository
                .Expect(c => c.GetContract(1))
                .Returns<Contract>(null);

            var request = new GetUnInvoicedCallsRequest { ContractId = 1, User = CreateIUser() };
            var response = _service.GetUnInvoicedCalls(request);

            Assert.IsFalse(response.IsSuccessful);
            Assert.AreEqual(response.Message, "Contract 1 not found.");
        }
예제 #3
0
        public void Retrieve_uninvoiced_calls_for_contract()
        {
            // check contract exists
            _contractRepository
                .Expect(c => c.GetContract(1))
                .Returns(new Contract(1, DateTime.Now));

            // return some calls for the contract
            _contractRepository
                .Expect(c => c.GetNonInvoicedCallsByContractId(1))
                .Returns(new List<Call>
                            {
                                new Call(1)
                                    {
                                        CalledFrom = "Test",
                                        CallTime = DateTime.Now,
                                        ContractId = 1,
                                        Cost = 5m,
                                        Volume = 15.4m,
                                        HasFreeCallTariff = false,
                                        ImportedCallType = "Test",
                                        NumberCalled = "123923TEST",
                                        PhoneNumber = "MINE"
                                    }
                            });

            var request = new GetUnInvoicedCallsRequest { ContractId = 1, User = CreateIUser() };
            var response = _service.GetUnInvoicedCalls(request);
            Assert.IsTrue(response.IsSuccessful, "Successful");
            Assert.IsTrue(response.UninvoicedCalls.Count == 1, "Count");
        }