Skip to content

Commit

Permalink
WAF add test for MockView
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 committed Dec 8, 2023
1 parent c159d66 commit 866e525
Showing 1 changed file with 30 additions and 0 deletions.
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
{
}
}
}

0 comments on commit 866e525

Please sign in to comment.