csharpdeeb25a2 | 1 | using Avalonia.Headless.XUnit; |
| 2 | using Avalonia.Controls; |
| 3 | using CascadeIDE.ViewModels; |
| 4 | using CascadeIDE.Views; |
| 5 | using Xunit; |
| 6 | |
| 7 | namespace CascadeIDE.Tests; |
| 8 | |
| 9 | public sealed class ViewLocatorTests |
| 10 | { |
| 11 | [AvaloniaFact] |
| 12 | public void Build_DockDocumentViewModel_ReturnsDockDocumentView() |
| 13 | { |
| 14 | var locator = new ViewLocator(); |
| 15 | var vm = new DockDocumentViewModel(new OpenDocumentViewModel("a.cs", "a.cs", "class A {}")); |
| 16 | |
| 17 | var control = locator.Build(vm); |
| 18 | |
| 19 | Assert.IsType<DockDocumentView>(control); |
| 20 | } |
| 21 | |
| 22 | [AvaloniaFact] |
| 23 | public void Build_MarkdownDockDocumentViewModel_DoesNotRequireInlinePreviewHost() |
| 24 | { |
| 25 | var locator = new ViewLocator(); |
| 26 | var vm = new DockDocumentViewModel(new OpenDocumentViewModel("note.md", "note.md", "# Title")); |
| 27 | |
| 28 | var control = Assert.IsType<DockDocumentView>(locator.Build(vm)); |
| 29 | |
| 30 | Assert.Null(control.FindControl<ContentControl>("InlineMarkdownPreviewHost")); |
| 31 | } |
| 32 | } |
| 33 | |
View only · write via MCP/CIDE