public void ChangingCurrentProjectSavesToSettings() { // Arrange var context = new MockContext(); context.SettingsRepoMock.Setup( s => s.Set( SettingKeys.LastProject, "1" ) ).Verifiable(); context.SettingsRepoMock.Setup( x => x.GetById( SettingKeys.LastProject ) ).Returns( new Config {Id = SettingKeys.LastProject, Value = "-1"} ); context.ProjectRepoMock.Setup( x => x.GetAll() ).Returns( new[] { new Project {Id = 1} } ); var vm = new ProjectListViewModel( context.ViewServiceRepo, context.SettingsRepo, context.ProjectRepo ); vm.Reset(); // Act vm.Projects[0].IsCurrent = true; // Assert context.SettingsRepoMock.VerifyAll(); }
public void ResetErasesProjectName() { // Arrange var context = new MockContext(); var vm = new ProjectListViewModel( context.ViewServiceRepo, context.SettingsRepo, context.ProjectRepo ); // Act vm.NewProjectName = "test"; vm.Reset(); // Assert Assert.IsTrue( string.IsNullOrEmpty( vm.NewProjectName ) ); }