34 lines
1.5 KiB
C#
34 lines
1.5 KiB
C#
using Bunit;
|
|
using Duempelkas.App.Components;
|
|
using Duempelkas.App.Services;
|
|
using Xunit;
|
|
|
|
namespace Duempelkas.Tests;
|
|
|
|
public class EntryLifecycleUiTests
|
|
{
|
|
[Fact]
|
|
public async Task DeleteTransfer_ExplainsBothAccounts_HidesRows_AndUndoRestoresBoth()
|
|
{
|
|
using var f = new LedgerUiFixture();
|
|
var entries = f.Service<IEntryService>();
|
|
await entries.CreateTransferAsync(1, 2, DateTime.Today, "Testtransfer", 20m);
|
|
var page = f.Context.Render<Routes>();
|
|
page.WaitForElement(".account-card").Click();
|
|
page.WaitForElement(".entry-action-buttons");
|
|
page.Find("button.btn-outline-danger").Click();
|
|
page.WaitForAssertion(() => Assert.Contains("beiden Konten", page.Markup));
|
|
Assert.Contains("Barkasse", page.Find("dialog").TextContent);
|
|
Assert.Contains("Girokonto", page.Find("dialog").TextContent);
|
|
page.Find("dialog button.btn-danger").Click();
|
|
page.WaitForAssertion(() => Assert.Empty(page.FindAll("tbody tr")));
|
|
Assert.All(await entries.GetEntriesAsync(2, (int?)null), e => Assert.True(e.IsDeleted));
|
|
page.Find(".history-toggle input").Change(true);
|
|
Assert.Contains("zählt nicht zum Kontostand", page.Markup);
|
|
page.Find(".toast-success .btn").Click();
|
|
page.WaitForAssertion(() => Assert.Single(page.FindAll("tbody tr")));
|
|
page.WaitForAssertion(() => Assert.Empty(page.FindAll(".deleted-status")));
|
|
Assert.All(await entries.GetEntriesAsync(2, (int?)null), e => Assert.False(e.IsDeleted));
|
|
}
|
|
}
|