示例#1
0
        public void Get_Client_By_Id_Must_Return_A_Client()
        {
            var stubClient = ClientListStub.GetFirst();

            var client = _service.getClientById(stubClient.Id);

            Assert.IsNotNull(client);
            Assert.AreEqual(client.Email, stubClient.Email);
            Assert.AreEqual(client.Id, stubClient.Id);
            Assert.AreEqual(client.Name, stubClient.Name);
            Assert.AreEqual(client.Role, stubClient.Role);
        }
示例#2
0
        public void Get_Client_By_User_Name_Must_Return_Client()
        {
            var clientStub = ClientListStub.GetFirst();

            _service.Setup(x => x.getClientByEmail(clientStub.Email)).Returns(ClientListStub.GetFirst());

            var result = _controller.GetClientByUserName(clientStub.Email) as OkObjectResult;
            var client = result.Value as Client;

            Assert.IsInstanceOf <OkObjectResult>(result);
            Assert.IsNotNull(result.Value);
            Assert.AreEqual(client.Id, clientStub.Id);
            Assert.AreEqual(client.Email, clientStub.Email);
        }
示例#3
0
        public void Get_Client_By_Policy_Number_Must_Return_A_Policy()
        {
            var stubClient = ClientListStub.GetFirst();
            var stubPolicy = PolicyListStub.GetFirst();

            _client.Setup(x => x.getClientById(stubClient.Id)).Returns(stubClient);

            var client = _service.getClientByPolicyNumber(stubPolicy.Id);

            Assert.IsNotNull(client);
            Assert.AreEqual(client.Email, stubClient.Email);
            Assert.AreEqual(client.Id, stubClient.Id);
            Assert.AreEqual(client.Name, stubClient.Name);
            Assert.AreEqual(client.Role, stubClient.Role);
        }
示例#4
0
        public void Get_Client_By_Id_Must_Return_Client()
        {
            var clientStub = ClientListStub.GetFirst();
            var stubPolicy = PolicyListStub.GetFirst();

            _service.Setup(x => x.GetListOfPoliciesByUserName(clientStub.Email)).Returns(PolicyListStub.GetAll());

            var result   = _controller.GetPoliciesByUserName(clientStub.Email) as OkObjectResult;
            var policies = result.Value as IEnumerable <Policy>;

            Assert.IsInstanceOf <OkObjectResult>(result);
            Assert.IsNotNull(result.Value);
            Assert.AreEqual(policies.ToList().First().Id, stubPolicy.Id);
            Assert.AreEqual(policies.ToList().First().Email, stubPolicy.Email);
        }
示例#5
0
        public void Get_List_Of_Policies_By_UserName_Must_Return_A_List()
        {
            var stubClient = ClientListStub.GetFirst();
            var stubPolicy = PolicyListStub.GetFirst();

            _client.Setup(x => x.getClientByEmail(stubClient.Email)).Returns(stubClient);

            var policies = _service.GetListOfPoliciesByUserName(stubClient.Email);

            Assert.IsNotNull(policies);
            Assert.IsTrue(policies.ToArray().Length > 0);
            Assert.AreEqual(policies.First().Id, stubPolicy.Id);
            Assert.AreEqual(policies.First().Email, stubPolicy.Email);
            Assert.AreEqual(policies.First().AmountInsured, stubPolicy.AmountInsured);
            Assert.AreEqual(policies.First().InstallmentPayment, stubPolicy.InstallmentPayment);
            Assert.AreEqual(policies.First().ClientId, stubPolicy.ClientId);
        }