public void ChangeViewModel() { NamedViewModelMock[] namedViewModels = new NamedViewModelMock[2] { new NamedViewModelMock("0"), new NamedViewModelMock("1") }; var applicationVm = new ApplicationViewModel(namedViewModels); applicationVm.ChangeViewModel(namedViewModels[1]); Assert.Same(namedViewModels[1], applicationVm.CurrentViewModel); }
public void ChangeViewModelOnlyIfExists() { NamedViewModelMock[] namedViewModels = new NamedViewModelMock[2] { new NamedViewModelMock("0"), new NamedViewModelMock("1") }; var applicationVm = new ApplicationViewModel(namedViewModels); NamedViewModelMock badViewModel = new NamedViewModelMock("2"); Assert.Throws <ArgumentOutOfRangeException>( () => { applicationVm.ChangeViewModel(badViewModel); } ); }