Exemplo n.º 1
0
        public void GetFilteredSubAreaWithEmptyPin()
        {
            var pinCode = string.Empty;
            var client  = new LeadsClient(baseUrl);

            Assert.Throws <InvalidOperationException>(() => client.GetFilteredSubArea(pinCode), "[exception] was not thrown as expected");
        }
Exemplo n.º 2
0
        public void GetFilteredSubAreaWithSpecialCharacters()
        {
            var pinCode  = "{]}@(*&)";
            var client   = new LeadsClient(baseUrl);
            var subAreas = client.GetFilteredSubArea(pinCode);

            Assert.IsTrue(subAreas.Count == 0, $"{nameof(subAreas)} quantity is not expected amount");
        }
Exemplo n.º 3
0
        public void GetFilteredSubAreaWithNoResults()
        {
            var pinCode  = "000";
            var client   = new LeadsClient(baseUrl);
            var subAreas = client.GetFilteredSubArea(pinCode);

            Assert.IsTrue(subAreas.Count == 0, $"{nameof(subAreas)} quantity is not expected amount");
        }
Exemplo n.º 4
0
        public void GetFilteredSubAreaWithSpecialCharacters2()
        {
            //Expected to fail as handing '+' on server side is not well done

            var pinCode  = "+";
            var client   = new LeadsClient(baseUrl);
            var subAreas = client.GetFilteredSubArea(pinCode);

            Assert.IsTrue(subAreas.Count == 0, $"{nameof(subAreas)} quantity is not expected amount");
        }
Exemplo n.º 5
0
        public void CreateLeadWithFilteredSubArea()
        {
            var client = new LeadsClient(baseUrl);

            var selectedPin = "567";

            var subAreas     = client.GetFilteredSubArea(selectedPin);
            var selectedArea = subAreas[0];

            var leadModel = new LeadsSaveViewModel()
            {
                Name         = "User1",
                Email        = "*****@*****.**",
                MobileNumber = "123456789",
                Address      = "FakeAddress",
                PinCode      = selectedArea.PinCode,
                SubAreaId    = selectedArea.Id
            };

            var result = client.CreateLead(leadModel);

            Assert.IsNotEmpty(result.Id, $"[{nameof(result.Id)}] empty");

            //search for created lead
            var searchLead = client.SearchLead(result.Id);

            //compare lead model
            Assert.AreEqual(leadModel.Name, searchLead.Name, $"[{nameof(searchLead.Name)}] not as expected");
            Assert.AreEqual(leadModel.Address, searchLead.Address, $"[{nameof(searchLead.Address)}] not as expected");
            Assert.AreEqual(leadModel.Email, searchLead.Email, $"[{nameof(searchLead.Email)}] not as expected");
            Assert.AreEqual(leadModel.MobileNumber, searchLead.MobileNumber, $"[{nameof(searchLead.MobileNumber)}] not as expected");
            Assert.AreEqual(leadModel.PinCode, searchLead.PinCode, $"[{nameof(searchLead.PinCode)}] not as expected");
            Assert.AreEqual(leadModel.SubAreaId, searchLead.SubAreaId, $"[{nameof(searchLead.SubAreaId)}] not as expected");

            //compare subarea model
            Assert.AreEqual(selectedArea.Name, searchLead.SubArea.Name, $"[{nameof(searchLead.SubArea.Name)}] not as expected");
            Assert.AreEqual(selectedArea.Id, searchLead.SubArea.Id, $"[{nameof(searchLead.SubArea.Id)}] not as expected");
            Assert.AreEqual(selectedArea.PinCode, searchLead.SubArea.PinCode, $"[{nameof(searchLead.SubArea.PinCode)}] not as expected");

            //Additional verificaion
            Assert.AreEqual(selectedPin, searchLead.PinCode, $"[{nameof(searchLead.PinCode)}] not as expected");
        }