assert non-disposed status for plugin in each routine, closes #1
This commit is contained in:
parent
7c8b241235
commit
0094f4cb85
@ -42,7 +42,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual("caused by test", parsed.message);
|
Assert.AreEqual("caused by test", parsed.message);
|
||||||
Assert.IsNull(parsed.apiServerError);
|
Assert.IsNull(parsed.apiServerError);
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Parse_ApiError_Test()
|
public void Parse_ApiError_Test()
|
||||||
@ -62,7 +62,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.IsNull(parsed.title);
|
Assert.IsNull(parsed.title);
|
||||||
Assert.IsNull(parsed.traceId);
|
Assert.IsNull(parsed.traceId);
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Parse_Credentials_Test()
|
public void Parse_Credentials_Test()
|
||||||
@ -79,7 +79,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual("test1", parsed.database);
|
Assert.AreEqual("test1", parsed.database);
|
||||||
Assert.AreEqual("mandant1", parsed.mandant);
|
Assert.AreEqual("mandant1", parsed.mandant);
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Parse_SalesPrognosisResult_Test()
|
public void Parse_SalesPrognosisResult_Test()
|
||||||
@ -95,7 +95,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual(12, parsed.monat);
|
Assert.AreEqual(12, parsed.monat);
|
||||||
Assert.AreEqual(3000.3456m, parsed.vorhersage);
|
Assert.AreEqual(3000.3456m, parsed.vorhersage);
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Parse_SalesPrognosisResults_Test()
|
public void Parse_SalesPrognosisResults_Test()
|
||||||
@ -118,7 +118,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual(arr[i], parsed.daten[i]);
|
Assert.AreEqual(arr[i], parsed.daten[i]);
|
||||||
}
|
}
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Parse_SalesPrognosisExport_Test()
|
public void Parse_SalesPrognosisExport_Test()
|
||||||
@ -147,7 +147,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual(data.daten[i], parsed.response.daten[i]);
|
Assert.AreEqual(data.daten[i], parsed.response.daten[i]);
|
||||||
}
|
}
|
||||||
PrettyPrint(parsed);
|
PrettyPrint(parsed);
|
||||||
plugin.Shutdown();
|
plugin.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
public void ConstructInitialiseFinalise_Test()
|
public void ConstructInitialiseFinalise_Test()
|
||||||
{
|
{
|
||||||
var test = new TPlugin();
|
var test = new TPlugin();
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Set_and_Obtain_Credentials_Test()
|
public void Set_and_Obtain_Credentials_Test()
|
||||||
@ -76,7 +76,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual(password, creds.password);
|
Assert.AreEqual(password, creds.password);
|
||||||
Assert.AreEqual(database, creds.database);
|
Assert.AreEqual(database, creds.database);
|
||||||
Assert.AreEqual(mandant, creds.mandant);
|
Assert.AreEqual(mandant, creds.mandant);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Set_and_Obtain_BaseApiUrl_Test()
|
public void Set_and_Obtain_BaseApiUrl_Test()
|
||||||
@ -87,7 +87,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var apiUrlGet = test.GetBaseApiUrl();
|
var apiUrlGet = test.GetBaseApiUrl();
|
||||||
Console.WriteLine($"Result from Python session was: {apiUrlGet}");
|
Console.WriteLine($"Result from Python session was: {apiUrlGet}");
|
||||||
Assert.AreEqual(apiUrlSet, apiUrlGet);
|
Assert.AreEqual(apiUrlSet, apiUrlGet);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Startup_Test()
|
public void Startup_Test()
|
||||||
@ -104,7 +104,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual(password, creds.password);
|
Assert.AreEqual(password, creds.password);
|
||||||
Assert.AreEqual(database, creds.database);
|
Assert.AreEqual(database, creds.database);
|
||||||
Assert.AreEqual(mandant, creds.mandant);
|
Assert.AreEqual(mandant, creds.mandant);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void UmsatzprognoseDummy_WithoutParams_Test()
|
public void UmsatzprognoseDummy_WithoutParams_Test()
|
||||||
@ -114,7 +114,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
test.Startup(apiUrlSet, user, password, database, mandant);
|
test.Startup(apiUrlSet, user, password, database, mandant);
|
||||||
var res = test.UmsatzprognoseDummy(null, null);
|
var res = test.UmsatzprognoseDummy(null, null);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void UmsatzprognoseDummy_WithCompanyIdWithoutDate_Test()
|
public void UmsatzprognoseDummy_WithCompanyIdWithoutDate_Test()
|
||||||
@ -125,7 +125,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var comp_id = 1000;
|
var comp_id = 1000;
|
||||||
var res = test.UmsatzprognoseDummy(comp_id, null);
|
var res = test.UmsatzprognoseDummy(comp_id, null);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void UmsatzprognoseDummy_WithoutCompanyIdWithDate_Test()
|
public void UmsatzprognoseDummy_WithoutCompanyIdWithDate_Test()
|
||||||
@ -136,7 +136,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var date = new DateTime(2023, 1, 1, 12, 45, 30);
|
var date = new DateTime(2023, 1, 1, 12, 45, 30);
|
||||||
var res = test.UmsatzprognoseDummy(null, date);
|
var res = test.UmsatzprognoseDummy(null, date);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@ -149,7 +149,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var comp_id = 1024;
|
var comp_id = 1024;
|
||||||
var res = test.Umsatzprognose(comp_id, null);
|
var res = test.Umsatzprognose(comp_id, null);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[TestCategory("ActiveAPI")]
|
[TestCategory("ActiveAPI")]
|
||||||
@ -161,7 +161,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var date = new DateTime(2030, 1, 1, 12, 45, 30);
|
var date = new DateTime(2030, 1, 1, 12, 45, 30);
|
||||||
var res = test.Umsatzprognose(null, date);
|
var res = test.Umsatzprognose(null, date);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[TestCategory("ActiveAPI")]
|
[TestCategory("ActiveAPI")]
|
||||||
@ -173,7 +173,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var date = new DateTime(2015, 1, 1, 12, 45, 30);
|
var date = new DateTime(2015, 1, 1, 12, 45, 30);
|
||||||
var res = test.Umsatzprognose(null, date);
|
var res = test.Umsatzprognose(null, date);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
test.Shutdown();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,25 +18,25 @@ namespace dopt.DeltaBarth
|
|||||||
}
|
}
|
||||||
public void Startup(string basisApiUrl, string nutzername, string passwort, string datenbank, string mandant)
|
public void Startup(string basisApiUrl, string nutzername, string passwort, string datenbank, string mandant)
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
SetzeBasisApiUrl(basisApiUrl);
|
SetzeBasisApiUrl(basisApiUrl);
|
||||||
SetzeNutzerdaten(nutzername, passwort, datenbank, mandant);
|
SetzeNutzerdaten(nutzername, passwort, datenbank, mandant);
|
||||||
}
|
}
|
||||||
public void Shutdown()
|
|
||||||
{
|
|
||||||
base.Finalise();
|
|
||||||
}
|
|
||||||
public void SetzeBasisApiUrl(string basisApiUrl)
|
public void SetzeBasisApiUrl(string basisApiUrl)
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
pyModManagement.set_base_url(basisApiUrl);
|
pyModManagement.set_base_url(basisApiUrl);
|
||||||
}
|
}
|
||||||
public void SetzeNutzerdaten(string nutzername, string passwort, string datenbank, string mandant)
|
public void SetzeNutzerdaten(string nutzername, string passwort, string datenbank, string mandant)
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
using (Py.GIL()) {
|
using (Py.GIL()) {
|
||||||
pyModManagement.set_credentials(nutzername, passwort, datenbank, mandant);
|
pyModManagement.set_credentials(nutzername, passwort, datenbank, mandant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public JsonStructs.UmsatzPrognoseAusgabe UmsatzprognoseDummy(int? firmaId, DateTime? buchungsDatum)
|
public JsonStructs.UmsatzPrognoseAusgabe UmsatzprognoseDummy(int? firmaId, DateTime? buchungsDatum)
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
string pyJson;
|
string pyJson;
|
||||||
using (Py.GIL())
|
using (Py.GIL())
|
||||||
{
|
{
|
||||||
@ -48,6 +48,7 @@ namespace dopt.DeltaBarth
|
|||||||
}
|
}
|
||||||
public JsonStructs.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? buchungsDatum)
|
public JsonStructs.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? buchungsDatum)
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
string pyJson;
|
string pyJson;
|
||||||
using (Py.GIL())
|
using (Py.GIL())
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ namespace dopt.DeltaBarth
|
|||||||
}
|
}
|
||||||
protected string GetBaseApiUrl()
|
protected string GetBaseApiUrl()
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
string pyJson;
|
string pyJson;
|
||||||
using (Py.GIL())
|
using (Py.GIL())
|
||||||
{
|
{
|
||||||
@ -68,6 +70,7 @@ namespace dopt.DeltaBarth
|
|||||||
}
|
}
|
||||||
protected JsonStructs.Credentials GetCredentials()
|
protected JsonStructs.Credentials GetCredentials()
|
||||||
{
|
{
|
||||||
|
AssertNotDisposed();
|
||||||
string pyJson;
|
string pyJson;
|
||||||
using (Py.GIL())
|
using (Py.GIL())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="dopt.SharpPython" Version="0.2.1" />
|
<PackageReference Include="dopt.SharpPython" Version="0.3.0" />
|
||||||
<Content Include="..\python\**\*">
|
<Content Include="..\python\**\*">
|
||||||
<Link>python\%(RecursiveDir)/%(FileName)%(Extension)</Link>
|
<Link>python\%(RecursiveDir)/%(FileName)%(Extension)</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user