Initial Commit

This commit is contained in:
2016-07-27 00:32:34 -04:00
commit 8d162b2035
701 changed files with 188672 additions and 0 deletions

View File

@@ -0,0 +1,558 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Pluto.Api;
using Sdaleo.Systems.SQLServer;
using Connector = PlutoServer.MSL.Connectors;
namespace PlutoServer.MSL.Test
{
[TestFixture]
public class LytecConnector
{
#region Lytec Test Connection
const string LYTEC_KEY = "$616866C0D12EC1641A5#L";
public SQLServerCredential credential = new SQLServerCredential("10.97.156.22","LytecMD","Lytec Tutorial", "sa", "Clinical$1");
#endregion
[SetUp]
public void Init()
{
MSLSpecific.Setup_Test_Logger();
Connector.DBCache.IsMachine_Used_ForTesting = true;
Connector.DBCache.TestLytecUserDBCredential = credential;
}
[Test]
public void GetProviderList()
{
ProviderInfo1[] providers = Connector.LytecConnector.GetProviderList(LYTEC_KEY);
Assert.NotNull(providers);
if (providers != null)
{
Assert.True(providers.Length > 0);
if (providers.Length > 0)
{
foreach (ProviderInfo1 info in providers)
{
// User ID must exist for provider
Assert.IsNotNullOrEmpty(info.UserId);
// Assume the provider has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
}
}
}
}
[Test]
public void GetPatientList()
{
PatientInfo1[] patients = Connector.LytecConnector.GetPatientList(LYTEC_KEY, "", "", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
}
}
}
}
[Test]
public void GetPatient_Caesar_J()
{
PatientInfo1[] patients = Connector.LytecConnector.GetPatientList(LYTEC_KEY, "Caesar", "J", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check For John and Jane Doe
if (info.LastName == "Caesar")
Assert.True(info.FirstName == "Jay" || info.FirstName == "Julie");
}
}
}
}
[Test]
public void GetPatient_C()
{
PatientInfo1[] patients = Connector.LytecConnector.GetPatientList(LYTEC_KEY, "C", "", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check to make sure last name contains a C
Assert.True(info.LastName.ToUpper().Contains("C"));
}
}
}
}
[Test]
public void GetPatient_DOB()
{
PatientInfo1[] patients = Connector.LytecConnector.GetPatientList(LYTEC_KEY, "", "", "01/10/1975");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length == 1);
if (patients.Length == 1)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check to make sure last name is DOE
Assert.True(info.LastName.ToUpper() == "DE LA ROSA");
// Check to make sure first name is Jane
Assert.True(info.FirstName.ToUpper() == "ROSA");
}
}
}
}
[Test]
public void GetFacilitiesList()
{
FacilityInfo1[] facilities = Connector.LytecConnector.GetFacilitiesList(LYTEC_KEY);
Assert.NotNull(facilities);
if (facilities != null)
{
Assert.True(facilities.Length > 0);
if (facilities.Length > 0)
{
foreach (FacilityInfo1 info in facilities)
{
// Code must exist for each facility
Assert.IsNotNullOrEmpty(info.Code);
// Assume the facility has at least a name
Assert.True(!String.IsNullOrEmpty(info.Name));
}
}
}
}
[Test]
public void GetDiagnosisList()
{
TerminologyInfo1[] diagnoses = Connector.LytecConnector.GetDiagnosisList(LYTEC_KEY, String.Empty);
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
}
}
}
}
[Test]
public void GetDiagnosis_1()
{
TerminologyInfo1[] diagnoses = Connector.LytecConnector.GetDiagnosisList(LYTEC_KEY, "1");
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("1") || info.Description.Contains("1"));
}
}
}
}
[Test]
public void GetDiagnosis_Dia()
{
TerminologyInfo1[] diagnoses = Connector.LytecConnector.GetDiagnosisList(LYTEC_KEY, "Dia");
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("Dia") || info.Description.Contains("Dia"));
}
}
}
}
[Test]
public void GetProcedureList()
{
TerminologyInfo1[] procedures = Connector.LytecConnector.GetProceduresList(LYTEC_KEY, String.Empty, String.Empty);
Assert.NotNull(procedures);
if (procedures != null)
{
Assert.True(procedures.Length > 0);
if (procedures.Length > 0)
{
foreach (TerminologyInfo1 info in procedures)
{
// Code must exist for each procedures
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each procedures
Assert.IsNotNullOrEmpty(info.Description);
}
}
}
}
[Test]
public void GetProcedure_1()
{
TerminologyInfo1[] procedures = Connector.LytecConnector.GetProceduresList(LYTEC_KEY, String.Empty, "1");
Assert.NotNull(procedures);
if (procedures != null)
{
Assert.True(procedures.Length > 0);
if (procedures.Length > 0)
{
foreach (TerminologyInfo1 info in procedures)
{
// Code must exist for each procedures
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each procedures
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("1") || info.Description.Contains("1"));
}
}
}
}
[Test]
public void Authenticate_System()
{
UserInfo1 info = Connector.LytecConnector.AuthenticateUserLogin(LYTEC_KEY, "system", "system1");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
}
[Test]
public void Authenticate_98()
{
UserInfo1 info = Connector.LytecConnector.AuthenticateUserLogin(LYTEC_KEY, "98", "2");
Assert.Null(info);
}
/// <summary>
/// Assumes that the User 1 has a Pin of 1234 (that is what should be setup in the UI by default)
/// </summary>
[Test]
public void AuthenticatePin_1()
{
Assert.True(Connector.LytecConnector.PinIsSet(LYTEC_KEY, "system"));
UserInfo1 info = Connector.LytecConnector.AuthenticateUserPIN(LYTEC_KEY, "system", "1212");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
}
/// <summary>
/// Sets the Pin to an arbitrary value for User 1, and checks if that authenticates, then
/// resets the pin back to the original value 1234
/// </summary>
[Test]
public void SetNAuthenticateNResetPin_1()
{
Assert.True(Connector.LytecConnector.CreatePin(LYTEC_KEY, "system", "9999"));
UserInfo1 info = Connector.LytecConnector.AuthenticateUserPIN(LYTEC_KEY, "system", "9999");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
Assert.True(Connector.LytecConnector.CreatePin(LYTEC_KEY, "system", "1212"));
}
/// <summary>
/// Testing with 'blank' provider (none specified)
/// </summary>
[Test]
public void GetAppointments_2012()
{
DateTime dtStart = new DateTime(2012, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2012, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "";
AppointmentInfo1[] appointments = Connector.LytecConnector.GetAppointments(LYTEC_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2012);
}
}
}
}
/// <summary>
/// Testing with 'JM' provider (specified)
/// </summary>
[Test]
public void GetAppointments_2012_DDL()
{
DateTime dtStart = new DateTime(2012, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2012, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "DDL";
AppointmentInfo1[] appointments = Connector.LytecConnector.GetAppointments(LYTEC_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2012);
// Provider must either be JM or blank
Assert.True(appt.ProviderCode == "DDL" || appt.ProviderCode == "");
}
}
}
}
/// <summary>
/// Testing with 'blank' provider (none specified)
/// </summary>
[Test]
public void GetAppointments_2013()
{
DateTime dtStart = new DateTime(2013, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2013, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "";
AppointmentInfo1[] appointments = Connector.LytecConnector.GetAppointments(LYTEC_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2013);
}
}
}
}
/// <summary>
/// Testing with 'JM' provider (specified)
/// </summary>
[Test]
public void GetAppointments_2013_DDL()
{
DateTime dtStart = new DateTime(2013, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2013, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "DDL";
AppointmentInfo1[] appointments = Connector.LytecConnector.GetAppointments(LYTEC_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2013);
// Provider must either be JM or blank
Assert.True(appt.ProviderCode == "DDL" || appt.ProviderCode == "");
}
}
}
}
[Test]
public void GetAppointmentDetail_1()
{
AppointmentDetail1 detail = Connector.LytecConnector.GetAppointmentDetail(LYTEC_KEY, 1, true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.NotNull(detail.PatientDetail);
if (detail.PatientDetail != null)
{
Assert.IsNotNullOrEmpty(detail.PatientDetail.Patient.ChartId);
Assert.IsTrue(detail.PatientDetail.Patient.ChartId == "SMITH10000");
}
}
}
[Test]
public void GetAppointmentDetail_2()
{
AppointmentDetail1 detail = Connector.LytecConnector.GetAppointmentDetail(LYTEC_KEY, 2, true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.NotNull(detail.PatientDetail);
if (detail.PatientDetail != null)
{
Assert.IsNotNullOrEmpty(detail.PatientDetail.Patient.ChartId);
Assert.IsTrue(detail.PatientDetail.Patient.ChartId == "SMITH10001");
}
}
}
[Test]
public void GetPatientDetail_Steve()
{
PatientDetail1 detail = Connector.LytecConnector.GetPatientDetail(LYTEC_KEY, null, "0000000100", true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.IsNotNullOrEmpty(detail.Patient.ChartId);
Assert.IsTrue(detail.Patient.ChartId == "0000000100");
Assert.IsTrue(detail.Patient.FirstName == "Steve");
Assert.IsTrue(detail.Patient.LastName == "Lyashtuck");
}
}
[Test]
public void PostIntoPendingTransaction_1()
{
BillingPost1 bill = new BillingPost1();
//bill.BirthDate = DateTime.MinValue;
bill.BirthDate = new DateTime(1974, 8, 13);
bill.ChartID = "ALDERM0000";
bill.DateFrom = DateTime.Now;
bill.PatientFirstName = "Robert";
bill.PatientLastName = "Aldermend";
bill.PatientSocialSecurity = "648-54-1679";
//bill.PatientSocialSecurity = "";
bill.ProviderID = "DDL";
bill.BillingDetails = new BillingDetail1[5] { new BillingDetail1(), new BillingDetail1(), new BillingDetail1(), new BillingDetail1(), new BillingDetail1() };
int nLength = bill.BillingDetails.Length;
bill.BillingDetails[0].Units = 2;
bill.BillingDetails[0].DiagnosisCodes = new string[] { "728.4" };
bill.BillingDetails[0].ProcedureCode = "11426";
bill.BillingDetails[1].BillingNote = "Doris Day";
bill.BillingDetails[2].BillingNote = "Doris Day";
bill.BillingDetails[3].Units = 4;
bill.BillingDetails[3].DiagnosisCodes = new string[] { "728.4" };
bill.BillingDetails[3].ProcedureCode = "11426";
bill.BillingDetails[4].Units = 4;
bill.BillingDetails[4].DiagnosisCodes = new string[] { "728.4" };
bill.BillingDetails[4].ProcedureCode = "11426";
bool bSuccess = Connector.LytecConnector.PostBilling(LYTEC_KEY, "system", bill);
Assert.IsTrue(bSuccess);
}
}
}

View File

@@ -0,0 +1,173 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Pluto.Api;
using Sdaleo.Systems.Advantage;
using Sdaleo.Systems.SQLServer;
using Connector = PlutoServer.MSL.Connectors;
namespace PlutoServer.MSL.Test
{
[TestFixture]
public class MSLConnect
{
#region Test Connections
/// <summary>
/// Advantage Shared Test Credential
/// </summary>
public const string MEDISOFT_REGISTRATION = "Not Registered";
public const string MEDISOFT_DATASET = "Medical Group (Tutorial Data)";
public const string MEDISOFT_PRACTICE = "Happy Clinic";
public AdvantageCredential AdvantageTestSharedCredential = new AdvantageCredential(@"\\10.97.156.4\Medidata\SharedData.add", "SharedDataUser", "AndPassword", AdvantageCredential.ServerType.REMOTE);
/// <summary>
/// SQLServer Shared Test Credential
/// </summary>
public const string LYTEC_REGISTRATION = "DEMO NOT FOR RESALE";
public const string LYTEC_DATASET = "Lytec Tutorial";
public const string LYTEC_PRACTICE = "Centertown Offices";
public SQLServerCredential SQLServerTestSharedCredential = new SQLServerCredential("10.97.156.22", "LytecMD", "Lytec SharedData", "sa", "Clinical$1");
#endregion
[SetUp]
public void Init()
{
MSLSpecific.Setup_Test_Logger();
}
[Test]
public void ProductSetupCompleted_Medisoft()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION);
Assert.True(bSuccess);
}
[Test]
public void ProductSetupCompleted_Lytec()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION);
Assert.True(bSuccess);
}
[Test]
public void MobileAboutFlow_Medisoft()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION);
Assert.True(bSuccess);
ApiKeyNPin a = m.MobileAboutDialogCalled(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION, MEDISOFT_PRACTICE, MEDISOFT_DATASET);
Assert.NotNull(a);
if (a != null)
{
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
}
}
[Test]
public void MobileAboutFlow_Lytec()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION);
Assert.True(bSuccess);
ApiKeyNPin a = m.MobileAboutDialogCalled(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION, LYTEC_PRACTICE, LYTEC_DATASET);
Assert.NotNull(a);
if (a != null)
{
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
}
}
[Test]
public void MobileAboutFlow_Medisoft30()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION);
Assert.True(bSuccess);
ApiKeyNPin a = m.MobileAboutDialogCalled(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION, MEDISOFT_PRACTICE, MEDISOFT_DATASET);
Assert.NotNull(a);
if (a != null)
{
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
if (!String.IsNullOrEmpty(a.UserApiKey) && !String.IsNullOrEmpty(a.UserPin))
{
// Check to make sure 30 times that the userapikey never changes
string apiKey = a.UserApiKey;
for (int i = 0; i < 30; ++i)
{
bSuccess = m.ProductSetupCompleted(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION);
Assert.True(bSuccess);
System.Threading.Thread.Sleep(50);
a = m.MobileAboutDialogCalled(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_REGISTRATION, MEDISOFT_PRACTICE, MEDISOFT_DATASET);
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
// change check!
Assert.True(a.UserApiKey == apiKey);
System.Threading.Thread.Sleep(50);
}
}
}
}
[Test]
public void MobileAboutFlow_Lytec30()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.ProductSetupCompleted(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION);
Assert.True(bSuccess);
ApiKeyNPin a = m.MobileAboutDialogCalled(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION, LYTEC_PRACTICE, LYTEC_DATASET);
Assert.NotNull(a);
if (a != null)
{
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
if (!String.IsNullOrEmpty(a.UserApiKey) && !String.IsNullOrEmpty(a.UserPin))
{
// Check to make sure 30 times that the userapikey never changes
string apiKey = a.UserApiKey;
for (int i = 0; i < 30; ++i)
{
bSuccess = m.ProductSetupCompleted(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION);
Assert.True(bSuccess);
System.Threading.Thread.Sleep(50);
a = m.MobileAboutDialogCalled(SQLServerTestSharedCredential.ConnectionString, LYTEC_REGISTRATION, LYTEC_PRACTICE, LYTEC_DATASET);
Assert.IsNotNullOrEmpty(a.UserApiKey);
Assert.IsNotNullOrEmpty(a.UserPin);
// change check!
Assert.True(a.UserApiKey == apiKey);
System.Threading.Thread.Sleep(50);
}
}
}
}
[Test]
public void PracticeNameChangeOccured_Medisoft()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.PracticeNameChangeOccured(AdvantageTestSharedCredential.ConnectionString, MEDISOFT_PRACTICE, MEDISOFT_DATASET);
Assert.True(bSuccess);
}
[Test]
public void PracticeNameChangeOccured_Lytec()
{
MSLSpecific m = new MSLSpecific();
bool bSuccess = m.PracticeNameChangeOccured(SQLServerTestSharedCredential.ConnectionString, LYTEC_PRACTICE, LYTEC_DATASET);
Assert.True(bSuccess);
}
}
}

View File

@@ -0,0 +1,560 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Pluto.Api;
using Sdaleo.Systems.Advantage;
using Connector = PlutoServer.MSL.Connectors;
namespace PlutoServer.MSL.Test
{
[TestFixture]
public class MedisoftConnector
{
#region Medisoft Test Connection
public const string MEDISOFT_KEY = "$616866C0D12EC1641A5#M";
public AdvantageCredential credential = new AdvantageCredential(@"\\10.97.156.4\Medidata\Tutor\mwddf.add", "user", "password", AdvantageCredential.ServerType.REMOTE);
#endregion
[SetUp]
public void Init()
{
MSLSpecific.Setup_Test_Logger();
Connector.DBCache.IsMachine_Used_ForTesting = true;
Connector.DBCache.TestMedisoftDBCredential = credential;
}
[Test]
public void GetProviderList()
{
ProviderInfo1[] providers = Connector.MedisoftConnector.GetProviderList(MEDISOFT_KEY);
Assert.NotNull(providers);
if (providers != null)
{
Assert.True(providers.Length > 0);
if (providers.Length > 0)
{
foreach (ProviderInfo1 info in providers)
{
// User ID must exist for provider
Assert.IsNotNullOrEmpty(info.UserId);
// Assume the provider has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
}
}
}
}
[Test]
public void GetPatientList()
{
PatientInfo1[] patients = Connector.MedisoftConnector.GetPatientList(MEDISOFT_KEY, "", "", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
}
}
}
}
[Test]
public void GetPatient_Doe_J()
{
PatientInfo1[] patients = Connector.MedisoftConnector.GetPatientList(MEDISOFT_KEY, "Doe", "J", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check For John and Jane Doe
if (info.LastName == "Doe")
Assert.True(info.FirstName == "Jane" || info.FirstName == "John");
}
}
}
}
[Test]
public void GetPatient_D()
{
PatientInfo1[] patients = Connector.MedisoftConnector.GetPatientList(MEDISOFT_KEY, "D", "", "");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length > 0);
if (patients.Length > 0)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check to make sure last name contains a D
Assert.True(info.LastName.ToUpper().Contains("D"));
}
}
}
}
[Test]
public void GetPatient_DOB()
{
PatientInfo1[] patients = Connector.MedisoftConnector.GetPatientList(MEDISOFT_KEY, "", "", "04/28/1962");
Assert.NotNull(patients);
if (patients != null)
{
Assert.True(patients.Length == 1);
if (patients.Length == 1)
{
foreach (PatientInfo1 info in patients)
{
// Chart must exist for patients
Assert.IsNotNullOrEmpty(info.ChartId);
// Assume the patient has at least one name field filled out
Assert.True(!String.IsNullOrEmpty(info.LastName) || !String.IsNullOrEmpty(info.FirstName) || !String.IsNullOrEmpty(info.MiddleName));
// Check to make sure last name is DOE
Assert.True(info.LastName.ToUpper() == "DOE");
// Check to make sure first name is Jane
Assert.True(info.FirstName.ToUpper() == "JANE");
}
}
}
}
[Test]
public void GetFacilitiesList()
{
FacilityInfo1[] facilities = Connector.MedisoftConnector.GetFacilitiesList(MEDISOFT_KEY);
Assert.NotNull(facilities);
if (facilities != null)
{
Assert.True(facilities.Length > 0);
if (facilities.Length > 0)
{
foreach (FacilityInfo1 info in facilities)
{
// Code must exist for each facility
Assert.IsNotNullOrEmpty(info.Code);
// Assume the facility has at least a name
Assert.True(!String.IsNullOrEmpty(info.Name));
}
}
}
}
[Test]
public void GetDiagnosisList()
{
TerminologyInfo1[] diagnoses = Connector.MedisoftConnector.GetDiagnosisList(MEDISOFT_KEY, String.Empty);
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
}
}
}
}
[Test]
public void GetDiagnosis_1()
{
TerminologyInfo1[] diagnoses = Connector.MedisoftConnector.GetDiagnosisList(MEDISOFT_KEY, "1");
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("1") || info.Description.Contains("1"));
}
}
}
}
[Test]
public void GetDiagnosis_Dia()
{
TerminologyInfo1[] diagnoses = Connector.MedisoftConnector.GetDiagnosisList(MEDISOFT_KEY, "Dia");
Assert.NotNull(diagnoses);
if (diagnoses != null)
{
Assert.True(diagnoses.Length > 0);
if (diagnoses.Length > 0)
{
foreach (TerminologyInfo1 info in diagnoses)
{
// Code must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each Diagnosis
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("Dia") || info.Description.Contains("Dia"));
}
}
}
}
[Test]
public void GetProcedureList()
{
TerminologyInfo1[] procedures = Connector.MedisoftConnector.GetProceduresList(MEDISOFT_KEY, String.Empty, String.Empty);
Assert.NotNull(procedures);
if (procedures != null)
{
Assert.True(procedures.Length > 0);
if (procedures.Length > 0)
{
foreach (TerminologyInfo1 info in procedures)
{
// Code must exist for each procedures
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each procedures
Assert.IsNotNullOrEmpty(info.Description);
}
}
}
}
[Test]
public void GetProcedure_1()
{
TerminologyInfo1[] procedures = Connector.MedisoftConnector.GetProceduresList(MEDISOFT_KEY, String.Empty, "1");
Assert.NotNull(procedures);
if (procedures != null)
{
Assert.True(procedures.Length > 0);
if (procedures.Length > 0)
{
foreach (TerminologyInfo1 info in procedures)
{
// Code must exist for each procedures
Assert.IsNotNullOrEmpty(info.Code);
// Description must exist for each procedures
Assert.IsNotNullOrEmpty(info.Description);
// Code or Description must contain a "1"
Assert.True(info.Code.Contains("1") || info.Description.Contains("1"));
}
}
}
}
[Test]
public void Authenticate_1()
{
UserInfo1 info = Connector.MedisoftConnector.AuthenticateUserLogin(MEDISOFT_KEY, "1", "1");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
}
[Test]
public void Authenticate_98()
{
UserInfo1 info = Connector.MedisoftConnector.AuthenticateUserLogin(MEDISOFT_KEY, "98", "2");
Assert.Null(info);
}
/// <summary>
/// Assumes that the User 1 has a Pin of 1234 (that is what should be setup in the UI by default)
/// </summary>
[Test]
public void AuthenticatePin_1()
{
Assert.True(Connector.MedisoftConnector.PinIsSet(MEDISOFT_KEY, "1"));
UserInfo1 info = Connector.MedisoftConnector.AuthenticateUserPIN(MEDISOFT_KEY, "1", "1234");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
}
/// <summary>
/// Sets the Pin to an arbitrary value for User 1, and checks if that authenticates, then
/// resets the pin back to the original value 1234
/// </summary>
[Test]
public void SetNAuthenticateNResetPin_1()
{
Assert.True(Connector.MedisoftConnector.CreatePin(MEDISOFT_KEY, "1", "9999"));
UserInfo1 info = Connector.MedisoftConnector.AuthenticateUserPIN(MEDISOFT_KEY, "1", "9999");
Assert.NotNull(info);
if (info != null)
{
// Username must exist
Assert.IsNotNullOrEmpty(info.UserName);
// Name must exist
Assert.IsNotNullOrEmpty(info.Name);
}
Assert.True(Connector.MedisoftConnector.CreatePin(MEDISOFT_KEY, "1", "1234"));
}
/// <summary>
/// Testing with 'blank' provider (none specified)
/// </summary>
[Test]
public void GetAppointments_2012()
{
DateTime dtStart = new DateTime(2012, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2012, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "";
AppointmentInfo1[] appointments = Connector.MedisoftConnector.GetAppointments(MEDISOFT_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2012);
}
}
}
}
/// <summary>
/// Testing with 'JM' provider (specified)
/// </summary>
[Test]
public void GetAppointments_2012_JM()
{
DateTime dtStart = new DateTime(2012, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2012, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "JM";
AppointmentInfo1[] appointments = Connector.MedisoftConnector.GetAppointments(MEDISOFT_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2012);
// Provider must either be JM or blank
Assert.True(appt.ProviderCode == "JM" || appt.ProviderCode == "");
}
}
}
}
/// <summary>
/// Testing with 'blank' provider (none specified)
/// </summary>
[Test]
public void GetAppointments_2013()
{
DateTime dtStart = new DateTime(2013, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2013, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "";
AppointmentInfo1[] appointments = Connector.MedisoftConnector.GetAppointments(MEDISOFT_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2013);
}
}
}
}
/// <summary>
/// Testing with 'JM' provider (specified)
/// </summary>
[Test]
public void GetAppointments_2013_JM()
{
DateTime dtStart = new DateTime(2013, 01, 01, 0, 0, 0);
DateTime dtEnd = new DateTime(2013, 12, 31, 23, 59, 59);
ProviderInfo1 info = new ProviderInfo1();
info.UserId = "JM";
AppointmentInfo1[] appointments = Connector.MedisoftConnector.GetAppointments(MEDISOFT_KEY, new ProviderInfo1[] { info }, null, dtStart, dtEnd);
Assert.NotNull(appointments);
if (appointments != null)
{
Assert.True(appointments.Length > 0);
if (appointments.Length > 0)
{
foreach (AppointmentInfo1 appt in appointments)
{
// Appt ID must be valid
Assert.True(appt.Id > 0);
// Appt Date must be valid
Assert.True(appt.StartDateTime.Year == 2013);
// Provider must either be JM or blank
Assert.True(appt.ProviderCode == "JM" || appt.ProviderCode == "");
}
}
}
}
[Test]
public void GetAppointmentDetail_1()
{
AppointmentDetail1 detail = Connector.MedisoftConnector.GetAppointmentDetail(MEDISOFT_KEY, 1, true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.NotNull(detail.PatientDetail);
if (detail.PatientDetail != null)
{
Assert.IsNotNullOrEmpty(detail.PatientDetail.Patient.ChartId);
Assert.IsTrue(detail.PatientDetail.Patient.ChartId == "AGADW000");
}
}
}
[Test]
public void GetAppointmentDetail_2()
{
AppointmentDetail1 detail = Connector.MedisoftConnector.GetAppointmentDetail(MEDISOFT_KEY, 2, true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.NotNull(detail.PatientDetail);
if (detail.PatientDetail != null)
{
Assert.IsNotNullOrEmpty(detail.PatientDetail.Patient.ChartId);
Assert.IsTrue(detail.PatientDetail.Patient.ChartId == "AGADW000");
}
}
}
[Test]
public void GetPatientDetail_Dwight()
{
PatientDetail1 detail = Connector.MedisoftConnector.GetPatientDetail(MEDISOFT_KEY, null, "AGADW000", true);
Assert.NotNull(detail);
if (detail != null)
{
Assert.IsNotNullOrEmpty(detail.Patient.ChartId);
Assert.IsTrue(detail.Patient.ChartId == "AGADW000");
Assert.IsTrue(detail.Patient.FirstName == "Dwight");
Assert.IsTrue(detail.Patient.LastName == "Again");
}
}
[Test]
public void PostIntoPendingTransaction_1()
{
BillingPost1 bill = new BillingPost1();
bill.BirthDate = DateTime.MinValue;
//bill.BirthDate = new DateTime(1963, 2, 2);
bill.ChartID = "CATSA000";
bill.DateFrom = DateTime.Now;
bill.PatientFirstName = "Sammy";
bill.PatientLastName = "Catera";
//bill.PatientSocialSecurity = "603-30-1930";
bill.PatientSocialSecurity = "";
bill.ProviderID = "AQZ";
bill.BillingDetails = new BillingDetail1[5] { new BillingDetail1(), new BillingDetail1(), new BillingDetail1(), new BillingDetail1(), new BillingDetail1() };
int nLength = bill.BillingDetails.Length;
bill.BillingDetails[0].Units = 2;
bill.BillingDetails[0].DiagnosisCodes = new string[] { "726.71" };
bill.BillingDetails[0].ProcedureCode = "99392";
bill.BillingDetails[1].BillingNote = "Doris Day";
bill.BillingDetails[2].BillingNote = "Doris Day";
bill.BillingDetails[3].Units = 4;
bill.BillingDetails[3].DiagnosisCodes = new string[] { "726.71" };
bill.BillingDetails[3].ProcedureCode = "99392";
bill.BillingDetails[4].Units = 4;
bill.BillingDetails[4].DiagnosisCodes = new string[] { "726.71" };
bill.BillingDetails[4].ProcedureCode = "99392";
bool bSuccess = Connector.MedisoftConnector.PostBilling(MEDISOFT_KEY, "1", bill);
Assert.IsTrue(bSuccess);
}
}
}

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D360B05B-D162-48E6-ACF5-92162DA78CEA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PlutoServer.MSL.Test</RootNamespace>
<AssemblyName>PlutoServer.MSL.Test</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Target\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Target\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="nunit.mocks, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="RemObjects.InternetPack, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL" />
<Reference Include="RemObjects.SDK, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL" />
<Reference Include="RemObjects.SDK.Server, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL" />
<Reference Include="RemObjects.SDK.ZLib, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL" />
<Reference Include="Sdaleo, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\Sdaleo\Sdaleo.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LytecConnector.cs" />
<Compile Include="MedisoftConnector.cs" />
<Compile Include="MSLConnect.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PlutoServer.MSL\PlutoServer.MSL.csproj">
<Project>{36D78B93-9ECC-4BF1-852F-10E18B0EB41C}</Project>
<Name>PlutoServer.MSL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PlutoServer.MSL.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlutoServer.MSL.Test")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("67d0f17c-ee6f-4300-9c4d-09a1591ecc5a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]