PWAPP/UnitTests/UnitTest1.cs
2023-08-24 12:45:56 -04:00

60 lines
1.9 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using PWAPPv2.Source.API;
using PWAPPv2.Source.DataObjects;
// System.Threading.Tasks.Task<TResult>.Result.get returned "\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"" string
namespace UnitTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestV1Get()
{
APICredentials creds = new APICredentials();
creds.UserID = "testdoctor";
creds.Password = "testdoctor";
creds.PracticeId = "210";
creds.APIid = "12345678";
APIConnection conn = new APIConnection("http://apipatientweb.azurewebsites.net/", creds);
string res = conn.SendPostRequestAsync("api/PWReferralTypes");
Assert.AreEqual("\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"", res);
}
[TestMethod]
public void TestV2Get()
{
APICredentials creds = new APICredentials();
creds.UserID = "testdoctor";
creds.Password = "testdoctor";
creds.PracticeId = "210";
creds.APIid = "12345678";
APIConnection conn = new APIConnection("https://localhost:44354/", creds);
string res = conn.SendPostWithCredsInHeader("api/PWAppVersion", "");
}
[TestMethod]
[ExpectedException(typeof(RequestFailedExcpetion))]
public void TestInvalidCredentialsV2()
{
APICredentials creds = new APICredentials();
creds.UserID = "testdoctor";
creds.Password = "badPassword";
creds.PracticeId = "210";
creds.APIid = "12345678";
APIConnection conn = new APIConnection("https://localhost:44354/", creds);
string res = conn.SendPostWithCredsInHeader("api/PWAppVersion", "");
}
}
}