public void CurrentViewModelObservableIsAccurateViaWhenAnyObservable() { var fixture = new TestScreen(); fixture.WhenAnyObservable(x => x.Router.CurrentViewModel).ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var output).Subscribe(); fixture.Router = new RoutingState(); Assert.Equal(1, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "A" }); Assert.Equal(2, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "B" }); Assert.Equal(3, output.Count); Assert.Equal("B", ((TestViewModel)output.Last()).SomeProp); fixture.Router.NavigateBack.Execute(); Assert.Equal(4, output.Count); Assert.Equal("A", ((TestViewModel)output.Last()).SomeProp); }
public void CurrentViewModelObservableIsAccurateViaWhenAnyObservable() { var fixture = new TestScreen(); var output = fixture.WhenAnyObservable(x => x.Router.CurrentViewModel).CreateCollection(); fixture.Router = new RoutingState(); Assert.Equal(1, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "A" }); Assert.Equal(2, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "B" }); Assert.Equal(3, output.Count); Assert.Equal("B", ((TestViewModel)output.Last()).SomeProp); fixture.Router.NavigateBack.Execute(null); Assert.Equal(4, output.Count); Assert.Equal("A", ((TestViewModel)output.Last()).SomeProp); }
public void CurrentViewModelObservableIsAccurateViaWhenAnyObservable() { var fixture = new TestScreen(); var output = fixture.WhenAnyObservable(x => x.Router.CurrentViewModel).CreateCollection(); fixture.Router = new RoutingState(); Assert.Equal(1, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "A" }); Assert.Equal(2, output.Count); fixture.Router.Navigate.Execute(new TestViewModel() { SomeProp = "B" }); Assert.Equal(3, output.Count); Assert.Equal("B", ((TestViewModel)output.Last()).SomeProp); fixture.Router.NavigateBack.Execute(null); Assert.Equal(4, output.Count); Assert.Equal("A", ((TestViewModel)output.Last()).SomeProp); }