public void GetAllSubAreas() { var client = new LeadsClient(baseUrl); var subAreas = client.GetAllSubAreas(); Assert.IsTrue(subAreas.Count > 0, $"{nameof(subAreas)} is empty"); }
public void CreateLeadWithMismatchingSubAreaAndPin() { var client = new LeadsClient(baseUrl); var subAreas = client.GetAllSubAreas(); var selectedArea = subAreas[0]; var leadModel = new LeadsSaveViewModel() { Name = "User1", Email = "*****@*****.**", MobileNumber = "123456789", Address = "FakeAddress", PinCode = "6", SubAreaId = 1 }; Assert.Throws <InvalidOperationException>(() => client.CreateLead(leadModel), "[exception] was not thrown as expected"); }
public void CreateLeadNameSpecialCharacters() { var client = new LeadsClient(baseUrl); var subAreas = client.GetAllSubAreas(); var selectedArea = subAreas[0]; var leadModel = new LeadsSaveViewModel() { Name = "User1!@#$%^&*()_0", Email = "*****@*****.**", MobileNumber = "123456789", Address = "FakeAddress", PinCode = selectedArea.PinCode, SubAreaId = selectedArea.Id }; var result = client.CreateLead(leadModel); Assert.IsNotEmpty(result.Id, $"[{nameof(result.Id)}] empty"); }
public void CreateLeadAndSearch() { var client = new LeadsClient(baseUrl); var subAreas = client.GetAllSubAreas(); 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"); }