csharp4405de34 | 1 | using CascadeIDE.Cockpit.DataBus; |
| 2 | using Xunit; |
| 3 | |
| 4 | namespace CascadeIDE.Tests; |
| 5 | |
| 6 | public sealed class DataBusEventPolicyLoaderTests |
| 7 | { |
| 8 | [Fact] |
| 9 | public void TryParse_maps_burst_and_reliable() |
| 10 | { |
| 11 | const string toml = """ |
| 12 | [events] |
| 13 | FooEvent = "burst" |
| 14 | BarEvent = "reliable" |
| 15 | """; |
| 16 | |
| 17 | Assert.True(DataBusEventPolicyLoader.TryParse(toml, out var policy)); |
| 18 | Assert.True(policy.IsBurst(typeof(FooEvent))); |
| 19 | Assert.False(policy.IsBurst(typeof(BarEvent))); |
| 20 | } |
| 21 | |
| 22 | [Fact] |
| 23 | public void Load_succeeds_from_embedded_resource() |
| 24 | { |
| 25 | var policy = DataBusEventPolicyLoader.Load(); |
| 26 | Assert.True(policy.IsBurst(typeof(DebugStateChanged))); |
| 27 | Assert.True(policy.IsBurst(typeof(GitStateChanged))); |
| 28 | Assert.True(policy.IsBurst(typeof(IdeHostStateChanged))); |
| 29 | Assert.False(policy.IsBurst(typeof(BuildStateChanged))); |
| 30 | } |
| 31 | |
| 32 | private struct FooEvent; |
| 33 | private struct BarEvent; |
| 34 | } |
| 35 | |
View only · write via MCP/CIDE