-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The PropertyDictionary is a bit cumbersome. Want a way to access it more easily.
- Get the value easily
- Detect when keys exist or don't easily.
- Indexer access covers most scenarios, but may throw exceptions if it doesn't exist (maybe this is an acceptable way to fail the test)
Idea 1
public void ExampleOfUsage()
{
var log = TestCaptureLogger.GetLogs().First();
log.HasProperty("SomeProperty").ShouldBeTrue();
log["SomeProperty"].ShouldBe("SomeValue");
}
Idea 2
public void ExampleOfUsage()
{
var log = TestCaptureLogger.GetLogs().First();
LogProperty<string> prop = log["SomeProperty"]; // Always returns something
prop.Exists.ShouldBeTrue();
prop.IsOfType<string>().ShouldBeTrue();
prop.Value.ShouldBe("SomeValue");
prop.ShouldBe("SomeValue"); // Implicit cast to T
}
Metadata
Metadata
Assignees
Labels
No labels