public PatientSale CreatePatientRecord(ChatbotDataModelLib.Models.CustomerData data) { PatientSale patientSale = new PatientSale { CustomerId = data.CustomerId, CustomerName = data.CustomerName, ExecutiveName = executiveName, City = data.CustomerAddress, Model = data.Model }; return(patientSale); }
public bool PostNewMonitor(ChatbotDataModelLib.Models.CustomerData data) { PhilipsDBEntities record = new PhilipsDBEntities(); record.CustomerDatas.Add(data); record.SaveChanges(); executiveName = CheckSales(data); PatientSale patientSale = CreatePatientRecord(data); record.PatientSales.Add(patientSale); record.SaveChanges(); return(true); }
public string CheckSales(ChatbotDataModelLib.Models.CustomerData data) { PhilipsDBEntities record = new PhilipsDBEntities(); string name = "Main HQ"; var item = record.SalesReps.ToList(); for (int i = 0; i < record.SalesReps.Count(); i++) { if (item[i].City.Equals(data.CustomerAddress)) { name = item[i].ExecutiveName; } } return(name); }
public CustomerDataUnitTest() { patient1 = new PatientSale { CustomerId = 1, CustomerName = "Bishesh", ExecutiveName = "Prithu", City = "Delhi", Model = "MX500" }; _customerData = new ChatbotDataModelLib.Models.CustomerData { CustomerId = 1, CustomerName = "Bishesh", CustomerAddress = "Delhi", CustomerPhone = 9608292894, Product = "Intellivue", Model = "MX800" }; string ExeName = patient1.ExecutiveName; patientList.Add(patient1); customerDatas.Add(_customerData); Moq.Mock <ICustomerData> mockCustomerData = new Moq.Mock <ICustomerData>(); mockCustomerData.Setup(mcd => mcd.CreatePatientRecord(It.IsAny <ChatbotDataModelLib.Models.CustomerData>())).Returns(patient1); mockCustomerData.Setup(mcd => mcd.CheckSales(It.IsAny <ChatbotDataModelLib.Models.CustomerData>())).Returns(ExeName); mockCustomerData.Setup(mcd => mcd.PostNewMonitor(It.IsAny <ChatbotDataModelLib.Models.CustomerData>())).Returns((ChatbotDataModelLib.Models.CustomerData data) => { customerDatas.Add(data); return(true); }); this.MockCustomerDataRepository = mockCustomerData.Object; }