forked from MahApps/MahApps.Metro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomDialogTest.cs
39 lines (32 loc) · 1.06 KB
/
CustomDialogTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Threading.Tasks;
using System.Windows.Controls;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using Mahapps.Metro.Tests.TestHelpers;
using Xunit;
namespace Mahapps.Metro.Tests
{
public class CustomDialogTest : AutomationTestBase
{
[Fact]
public async Task ReceivesDataContext()
{
await TestHost.SwitchToAppThread();
var window = await WindowHelpers.CreateInvisibleWindowAsync<DialogWindow>();
var vm = new TheViewModel();
var dialog = (CustomDialog) window.Resources["CustomDialog"];
await window.ShowMetroDialogAsync(dialog);
await TestHost.SwitchToAppThread(); // No idea why we have to do this again
dialog.DataContext = vm;
var textBlock = dialog.FindChild<TextBlock>("TheDialogBody");
Assert.Equal(vm.Text, textBlock.Text);
}
private class TheViewModel
{
public string Text
{
get { return "TheText"; }
}
}
}
}