Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
895969b6ae | ||
|
|
54126814f3 | ||
|
|
b886abc632 |
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<Window x:Class="Elwig.Dialogs.ManualWeighingDialog"
|
||||
AutomationProperties.AutomationId="ManualWeighingDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Elwig.Helpers.Weighing {
|
||||
throw new WeighingException($"Fehler {error}: {msg}");
|
||||
} else if (error[0] == '3') {
|
||||
switch (error[1]) {
|
||||
case '1': msg = "Übertragunsfehler"; break;
|
||||
case '1': msg = "Übertragungsfehler"; break;
|
||||
case '2': msg = "Ungültiger Befehl"; break;
|
||||
case '3': msg = "Ungültiger Parameter"; break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Elwig;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Helpers.Billing;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Reflection;
|
||||
@@ -26,16 +25,6 @@ namespace Tests {
|
||||
App.SetBranch(ctx.Branches.Include(b => b.PostalDest).Single());
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
public async Task Setup_3_BillingData() {
|
||||
await BillingData.Init();
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void Setup_4_Culture() {
|
||||
Utils.OverrideCulture();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public async Task TeardownDatabase() {
|
||||
AppDbContext.ConnectionStringOverride = null;
|
||||
|
||||
@@ -67,7 +67,10 @@ namespace Tests.E2ETests {
|
||||
window.FindElement(By.WpfId("MemberInput")).SendKeys("Mustermann Max");
|
||||
window.FindElement(By.WpfId("WineVarietyInput")).SelectItem("Zweigelt");
|
||||
window.FindElement(By.WpfId("GradationKmwInput")).SendKeys("18");
|
||||
window.FindElement(By.Name("Wiegen")).Click();
|
||||
window.FindElement(By.WpfId("WeighingManualButton")).Click();
|
||||
var dialog = Session.CreateWindowDriver("ManualWeighingDialog");
|
||||
dialog.FindElement(By.WpfId("WeightInput")).SendKeys("2468");
|
||||
dialog.FindElement(By.WpfId("ConfirmButton")).Click();
|
||||
FinishDeliveryNote(window);
|
||||
window.Close();
|
||||
}
|
||||
@@ -76,7 +79,7 @@ namespace Tests.E2ETests {
|
||||
public void Test_3_AttributeCultivationModifier() {
|
||||
var window = OpenReceiptWindow();
|
||||
window.FindElement(By.WpfId("MgNrInput")).SendKeys("102" + Keys.Enter + "GVK");
|
||||
window.FindElement(By.WpfId("CultivationInput")).SelectItem("Bio");
|
||||
window.FindElement(By.WpfId("CultivationInput")).SelectItem("KIP");
|
||||
window.FindElement(By.WpfId("GradationOeInput")).SendKeys("73" + Keys.Enter + Keys.Enter);
|
||||
FinishDeliveryNote(window);
|
||||
window.Close();
|
||||
|
||||
@@ -20,7 +20,18 @@ namespace Tests.E2ETests {
|
||||
Session.App.FindElement(By.Name("Mitglieder")).Click();
|
||||
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
|
||||
var window = Session.CreateWindowDriver("MemberAdminWindow");
|
||||
Assert.That(window.Title, Is.EqualTo("Mitglieder - Elwig"));
|
||||
Assert.That(window.Title, Is.EqualTo("Mitglieder: aktive Mitglieder - Elwig"));
|
||||
window.Close();
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_Open_DeliveryAncmtWindow() {
|
||||
Assert.DoesNotThrow(() => {
|
||||
Session.App.FindElement(By.Name("Anmeldungen")).Click();
|
||||
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
|
||||
var window = Session.CreateWindowDriver("DeliveryAncmtWindow");
|
||||
Assert.That(window.Title, Is.EqualTo($"Anmeldungen: {DateTime.Today.Year} - Elwig"));
|
||||
window.Close();
|
||||
});
|
||||
}
|
||||
@@ -31,7 +42,7 @@ namespace Tests.E2ETests {
|
||||
Session.App.FindElement(By.Name("Lieferungen")).Click();
|
||||
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
|
||||
var window = Session.CreateWindowDriver("DeliveryAdminWindow");
|
||||
Assert.That(window.Title, Is.EqualTo("Lieferungen - Elwig"));
|
||||
Assert.That(window.Title, Is.EqualTo($"Lieferungen: {DateTime.Now.Year} - Elwig"));
|
||||
window.Close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace Tests.E2ETests {
|
||||
Window.FindElement(By.WpfId("IbanInput")).SendKeys("AT611904300234573201");
|
||||
Window.FindElement(By.WpfId("BicInput")).SendKeys("RLNWATWWWDF");
|
||||
|
||||
Window.FindElement(By.WpfId("UstIdNrInput")).SendKeys("ATU66192906"); // TODO: Testdaten?
|
||||
Window.FindElement(By.WpfId("LfbisNrInput")).SendKeys("1251074"); // TODO: Testdaten?
|
||||
Window.FindElement(By.WpfId("UstIdNrInput")).SendKeys("ATU01234565");
|
||||
Window.FindElement(By.WpfId("LfbisNrInput")).SendKeys("0123455");
|
||||
|
||||
Window.FindElement(By.WpfId("BuchführendInput")).Click();
|
||||
Window.FindElement(By.WpfId("OrganicInput")).Click();
|
||||
@@ -68,7 +68,7 @@ namespace Tests.E2ETests {
|
||||
Window.FindElement(By.WpfId("BillingPlzInput")).SendKeys("2120");
|
||||
Window.FindElement(By.WpfId("BillingOrtInput")).SelectItem(2);
|
||||
|
||||
Window.FindElement(By.WpfId("BusinessSharesInput")).SendKeys("10");
|
||||
Window.FindElement(By.WpfId("BusinessShares1Input")).SendKeys("10");
|
||||
Window.FindElement(By.WpfId("BranchInput")).SelectItem("Matzen");
|
||||
Window.FindElement(By.WpfId("DefaultKgInput")).SelectItem(3);
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Tests.E2ETests {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test, DependsOnTest("Test_1_CreateMember")]
|
||||
public void Test_2_EditMember() {
|
||||
Window!.FindElement(By.WpfId("SearchInput")).SendKeys("9999");
|
||||
Thread.Sleep(500);
|
||||
@@ -104,7 +104,7 @@ namespace Tests.E2ETests {
|
||||
|
||||
Window.FindElement(By.WpfId("EditMemberButton")).Click();
|
||||
|
||||
var businessSharesInput = Window.FindElement(By.WpfId("BusinessSharesInput"));
|
||||
var businessSharesInput = Window.FindElement(By.WpfId("BusinessShares1Input"));
|
||||
Assert.That(businessSharesInput, Is.Not.Null);
|
||||
|
||||
var businessShares = int.Parse(businessSharesInput.Text);
|
||||
@@ -117,7 +117,7 @@ namespace Tests.E2ETests {
|
||||
Assert.That(newBusinessShares, Is.EqualTo(businessShares + 5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test, DependsOnTest("Test_2_EditMember")]
|
||||
public void Test_3_DeleteMember() {
|
||||
Window!.FindElement(By.WpfId("SearchInput")).SendKeys("9999");
|
||||
Thread.Sleep(500);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using Elwig.Services;
|
||||
|
||||
namespace Tests {
|
||||
[SetUpFixture]
|
||||
public class InteractionSetup {
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void Setup() {
|
||||
InteractionService.Override = (mode, title, text) => {
|
||||
Assert.Fail($"User interaction requested: {mode} - {title} - {text}");
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void Teardown() {
|
||||
InteractionService.Override = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ INSERT INTO AT_plz_dest (plz, okz, dest) VALUES
|
||||
(2122, 05137, 'Riedenthal');
|
||||
|
||||
INSERT INTO client_parameter (param, value) VALUES
|
||||
('CLIENT_NAME_TOKEN', 'WGT'),
|
||||
('CLIENT_NAME_TOKEN', 'WGX'),
|
||||
('CLIENT_NAME_SHORT', 'WG Test'),
|
||||
('CLIENT_NAME', 'Winzergenossenschaft Test'),
|
||||
('CLIENT_NAME_SUFFIX', NULL),
|
||||
|
||||
@@ -138,3 +138,8 @@ INSERT INTO payment_member (year, avnr, mgnr, net_amount) VALUES
|
||||
INSERT INTO credit (year, tgnr, mgnr, avnr, net_amount, prev_net_amount, vat, modifiers, prev_modifiers) VALUES
|
||||
(2021, 1, 203, 1, 10000000, 0, 0.1, 0, 0),
|
||||
(2021, 2, 204, 1, 10000000, 0, 0.1, 0, 0);
|
||||
|
||||
INSERT INTO payment_variant (year, avnr, name, date, transfer_date, test_variant, calc_time, comment, data) VALUES
|
||||
(2021, 2, 'Berechnen', '2022-01-20', '2022-01-20', TRUE, NULL, NULL, '{"mode":"elwig","version":1,"payment":0.5,"curves":[]}'),
|
||||
(2021, 3, 'Löschen', '2022-01-20', '2022-01-20', TRUE, NULL, NULL, '{"mode":"elwig","version":1,"payment":0.5,"curves":[]}'),
|
||||
(2021, 4, 'Duplizieren', '2022-01-21', '2022-01-21', TRUE, NULL, NULL, '{"mode":"elwig","version":1,"payment":0.5,"curves":[]}');
|
||||
@@ -0,0 +1,20 @@
|
||||
using Elwig;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Helpers.Billing;
|
||||
|
||||
namespace Tests {
|
||||
[SetUpFixture]
|
||||
class Setup {
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void Setup_1_Config() {
|
||||
Utils.OverrideCulture();
|
||||
App.Config.Debug = true;
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
public async Task Setup_2_Init() {
|
||||
await BillingData.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Models.Entities;
|
||||
using Elwig.Services;
|
||||
using Elwig.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Tests.UnitTests.ServiceTests {
|
||||
[TestFixture]
|
||||
public class PaymentVariantServiceTest {
|
||||
|
||||
private static async Task InitViewModel(PaymentVariantsViewModel vm) {
|
||||
using var ctx = new AppDbContext();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Not implemented yet")]
|
||||
public async Task Test_FillInputs() {
|
||||
var vm = new PaymentVariantsViewModel();
|
||||
await InitViewModel(vm);
|
||||
//await vm.FillInputs();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test_CreatePaymentVariant() {
|
||||
HashSet<int> ids;
|
||||
using (var ctx = new AppDbContext()) {
|
||||
ids = await ctx.PaymentVariants.Where(v => v.Year == 2021).Select(v => v.AvNr).ToHashSetAsync();
|
||||
}
|
||||
PaymentVar? n = null;
|
||||
await Assert.DoesNotThrowAsync(async () => {
|
||||
n = await PaymentVariantService.CreatePaymentVariant(2021);
|
||||
});
|
||||
Assert.That(ids, Does.Not.Contain(n?.AvNr));
|
||||
using (var ctx = new AppDbContext()) {
|
||||
Assert.IsNotNull(await ctx.PaymentVariants.FindAsync(2021, n?.AvNr));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test_Duplicate() {
|
||||
HashSet<int> ids;
|
||||
using (var ctx = new AppDbContext()) {
|
||||
ids = await ctx.PaymentVariants.Where(v => v.Year == 2021).Select(v => v.AvNr).ToHashSetAsync();
|
||||
}
|
||||
Assert.That(ids, Does.Contain(4));
|
||||
PaymentVar? n = null;
|
||||
using (var ctx = new AppDbContext()) {
|
||||
var v = await ctx.PaymentVariants.FindAsync(2021, 4);
|
||||
await Assert.DoesNotThrowAsync(async () => {
|
||||
n = await PaymentVariantService.Duplicate(v!);
|
||||
});
|
||||
}
|
||||
Assert.That(ids, Does.Not.Contain(n?.AvNr));
|
||||
using (var ctx = new AppDbContext()) {
|
||||
Assert.IsNotNull(await ctx.PaymentVariants.FindAsync(2021, n?.AvNr));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Not implemented yet")]
|
||||
public async Task Test_UpdatePaymentVariant() {
|
||||
var vm = new PaymentVariantsViewModel();
|
||||
await InitViewModel(vm);
|
||||
//await vm.UpdatePaymentVariant();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test_DeletePaymentVariant() {
|
||||
using (var ctx = new AppDbContext()) {
|
||||
Assert.IsNotNull(await ctx.PaymentVariants.FindAsync(2021, 3));
|
||||
}
|
||||
await Assert.DoesNotThrowAsync(async () => await PaymentVariantService.DeletePaymentVariant(2021, 3));
|
||||
using (var ctx = new AppDbContext()) {
|
||||
Assert.IsNull(await ctx.PaymentVariants.FindAsync(2021, 3));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test_Calculate_Commit_Revert() {
|
||||
await Assert.DoesNotThrowAsync(async () => {
|
||||
await PaymentVariantService.Calculate(2021, 2);
|
||||
await PaymentVariantService.Commit(2021, 2);
|
||||
await PaymentVariantService.Revert(2021, 2);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGenerate_Summary_List() {
|
||||
var filename = Path.Combine(Path.GetTempPath(), "PaymentVariant.ods");
|
||||
Assert.That(!File.Exists(filename));
|
||||
InteractionService.NextSave = (_, _) => filename;
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
var v = await ctx.PaymentVariants.Where(v => v.Year == 2021 && v.AvNr == 2).SingleAsync();
|
||||
await PaymentVariantService.GenerateSummary(v, ExportMode.SaveList);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
Assert.IsNull(InteractionService.NextSave);
|
||||
Assert.That(File.Exists(filename));
|
||||
Assert.That(new FileInfo(filename).Length, Is.GreaterThan(0));
|
||||
}
|
||||
} finally {
|
||||
File.Delete(filename);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGenerate_Summary_Pdf() {
|
||||
var filename = Path.Combine(Path.GetTempPath(), "PaymentVariant.pdf");
|
||||
Assert.That(!File.Exists(filename));
|
||||
InteractionService.NextSave = (_, _) => filename;
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
var v = await ctx.PaymentVariants.Where(v => v.Year == 2021 && v.AvNr == 2).SingleAsync();
|
||||
await PaymentVariantService.GenerateSummary(v, ExportMode.SavePdf);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
Assert.IsNull(InteractionService.NextSave);
|
||||
Assert.That(File.Exists(filename));
|
||||
Assert.That(new FileInfo(filename).Length, Is.GreaterThan(0));
|
||||
}
|
||||
} finally {
|
||||
File.Delete(filename);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGenerate_Ebics() {
|
||||
var filename = Path.Combine(Path.GetTempPath(), "PaymentVariant.xml");
|
||||
Assert.That(!File.Exists(filename));
|
||||
InteractionService.NextSave = (_, _) => filename;
|
||||
try {
|
||||
await PaymentVariantService.GenerateEbics(2021, 2);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
Assert.IsNull(InteractionService.NextSave);
|
||||
Assert.That(File.Exists(filename));
|
||||
Assert.That(new FileInfo(filename).Length, Is.GreaterThan(0));
|
||||
}
|
||||
} finally {
|
||||
File.Delete(filename);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGenerate_AccountingList() {
|
||||
var filename = Path.Combine(Path.GetTempPath(), "PaymentVariant.ods");
|
||||
Assert.That(!File.Exists(filename));
|
||||
InteractionService.NextSave = (_, _) => filename;
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
var v = await ctx.PaymentVariants.Where(v => v.Year == 2021 && v.AvNr == 2).SingleAsync();
|
||||
await PaymentVariantService.GenerateAccountingList(v.Year, v.AvNr, v.Name);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
Assert.IsNull(InteractionService.NextSave);
|
||||
Assert.That(File.Exists(filename));
|
||||
Assert.That(new FileInfo(filename).Length, Is.GreaterThan(0));
|
||||
}
|
||||
} finally {
|
||||
File.Delete(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ type = SysTec-IT
|
||||
model = IT3000A
|
||||
connection = tcp://127.0.0.1:12345
|
||||
required = false
|
||||
synctime = false
|
||||
|
||||
[scale.2]
|
||||
type = Avery-Async
|
||||
|
||||
Reference in new issue
Block a user