add test cases for failing connections on API call tests

This commit is contained in:
Florian Förster 2025-04-10 08:10:07 +02:00
parent 95f958c29e
commit 821d9d1ed5

View File

@ -182,6 +182,18 @@ namespace dopt.DeltaBarth.Tests
test.Dispose(); test.Dispose();
} }
[TestMethod] [TestMethod]
public void Umsatzprognose_WithCompanyIdWithoutDate_Test_FailConnection()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var comp_id = 1024;
var res = test.Umsatzprognose(comp_id, null);
Assert.AreEqual(1, res.status.code);
PrettyPrint(res);
test.Dispose();
}
[TestMethod]
[TestCategory("ActiveAPI")] [TestCategory("ActiveAPI")]
public void Umsatzprognose_WithoutCompanyIdWithInvalidDate_Test() public void Umsatzprognose_WithoutCompanyIdWithInvalidDate_Test()
{ {
@ -195,6 +207,18 @@ namespace dopt.DeltaBarth.Tests
test.Dispose(); test.Dispose();
} }
[TestMethod] [TestMethod]
public void Umsatzprognose_WithoutCompanyIdWithInvalidDate_Test_FailConnection()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var date = new DateTime(2030, 1, 1, 12, 45, 30);
var res = test.Umsatzprognose(null, date);
Assert.AreEqual(1, res.status.code);
PrettyPrint(res);
test.Dispose();
}
[TestMethod]
[TestCategory("ActiveAPI")] [TestCategory("ActiveAPI")]
public void Umsatzprognose_WithoutCompanyIdWithValidDate_Test() public void Umsatzprognose_WithoutCompanyIdWithValidDate_Test()
{ {
@ -207,5 +231,17 @@ namespace dopt.DeltaBarth.Tests
PrettyPrint(res); PrettyPrint(res);
test.Dispose(); test.Dispose();
} }
[TestMethod]
public void Umsatzprognose_WithoutCompanyIdWithValidDate_Test_FailConnection()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var date = new DateTime(2015, 1, 1, 12, 45, 30);
var res = test.Umsatzprognose(null, date);
Assert.AreEqual(1, res.status.code);
PrettyPrint(res);
test.Dispose();
}
} }
} }