Created
March 24, 2012 08:59
-
-
Save anaisbetts/2180404 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [Fact] | |
| public void LoginScenarioRoutingTest() | |
| { | |
| var mock = new MoqMockingKernel(); | |
| mock.Bind<ILoginViewModel>().To<LoginViewModel>(); | |
| // Fake out the actual login code that makes sure the password is right | |
| mock.Bind<Func<IObservable<Unit>>>() | |
| .ToConstant<Func<IObservable<Unit>>>(() => Observable.Return(Unit.Default)) | |
| .Named("confirmUserPass"); | |
| var fixture = new AppViewModel(mock); | |
| // Our app starts on the Login page by default | |
| this.Log().Info("Current Route: {0}", fixture.Router.GetUrlForCurrentRoute()); | |
| var loginModel = fixture.Router.CurrentViewModel.First() as ILoginViewModel; | |
| loginModel.Should().NotBeNull(); | |
| // Put in a fake user/pass and hit the Ok button | |
| loginModel.User = "foo"; | |
| loginModel.Password = "bar"; | |
| loginModel.Confirm.Execute(null); | |
| // Make sure we're now showing the repo page | |
| this.Log().Info("Current Route: {0}", fixture.Router.GetUrlForCurrentRoute()); | |
| (fixture.Router.CurrentViewModel.First() is IRepoViewModel).Should().BeTrue(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment