Skip to content

Commit

Permalink
Fix issues, add coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaliumhexacyanoferrat committed Dec 17, 2024
1 parent e533ce3 commit e1b4a9e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Modules/Layouting/Provider/LayoutBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public LayoutBuilder Add(IHandlerBuilder handler)
return this;
}

public LayoutBuilder Add(IConcernBuilder concern)
{
_Concerns.Add(concern);
return this;
}

/// <summary>
/// Creates a new layout and registers it at the given path.
/// </summary>
Expand All @@ -103,12 +109,6 @@ public LayoutBuilder AddSegment(string segment)
return child;
}

public LayoutBuilder Add(IConcernBuilder concern)
{
_Concerns.Add(concern);
return this;
}

public IHandler Build()
{
var routed = RoutedHandlers.ToDictionary(kv => kv.Key, kv => kv.Value.Build());
Expand Down
16 changes: 16 additions & 0 deletions Testing/Acceptance/Modules/Layouting/MultiSegmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,20 @@ public void TestSegmentOccupied()
});
}

[TestMethod]
[MultiEngineTest]
public async Task TestEmpty(TestEngine engine)
{
var app = Layout.Create()
.Add([], Content.From(Resource.FromString("Hello Empty!")));

await using var host = await TestHost.RunAsync(app, engine: engine);

using var response = await host.GetResponseAsync();

await response.AssertStatusAsync(HttpStatusCode.OK);

Assert.AreEqual("Hello Empty!", await response.GetContentAsync());
}

}

0 comments on commit e1b4a9e

Please sign in to comment.