-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/System.Waf/System.Waf/System.Waf.Core.Test/UnitTesting/Mocks/MockViewTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Waf.Applications; | ||
using System.Waf.UnitTesting.Mocks; | ||
|
||
namespace Test.Waf.UnitTesting.Mocks | ||
{ | ||
[TestClass] | ||
public class MockViewTest | ||
{ | ||
[TestMethod] | ||
public void MockViewContextTest() | ||
{ | ||
IView v1 = new MyView(); | ||
var vm1 = new MyViewModel(v1); | ||
Assert.AreSame(vm1, v1.DataContext); | ||
#if NET6_0_OR_GREATER | ||
Assert.AreSame(vm1, v1.BindingContext); | ||
#endif | ||
} | ||
|
||
private class MyViewModel : ViewModelCore<IView> | ||
{ | ||
public MyViewModel(IView view) : base(view) { } | ||
} | ||
|
||
private sealed class MyView : MockView | ||
{ | ||
} | ||
} | ||
} |