public async Task UpdateNavigatesToContent() { var content = new Mock<IContentViewModel>(); var viewmodel = new MainViewModel(user); await viewmodel.Update(content.Object); content.Verify(c => c.OnNavigate()); }
public async Task UpdateClosesOldContent() { var old = new Mock<IContentViewModel>(); var current = new Mock<IContentViewModel>(); var viewmodel = new MainViewModel(user); await viewmodel.Update(old.Object); await viewmodel.Update(current.Object); old.Verify(o => o.OnClose()); }
public async Task UpdateRaisesChangeEvent() { var content = new Mock<IContentViewModel>(); var viewmodel = new MainViewModel(user); bool called = false; viewmodel.PropertyChanged += (sender, args) => { called = true; Assert.Equal(nameof(viewmodel.Content), args.PropertyName); }; await viewmodel.Update(content.Object); Assert.True(called); }
public NavigationServiceTest() { var builder = new ContainerBuilder(); var user = new UserViewModel(new Mock<IUser>().Object); builder.RegisterInstance(new MainViewModel(user)); builder.RegisterType<NavigationService>().AsSelf().As<INavigationService>(); builder.RegisterType<DummyClass>().AsSelf().Keyed<IContentViewModel>(Keys.Value1); builder.RegisterType<TestClass>().AsSelf().Keyed<IContentViewModel>(Keys.Value2); builder.RegisterType<ContentScope>(); container = builder.Build(); main = container.Resolve<MainViewModel>(); }