public void AddTagAddsToProject() { // Arrange var context = new MockContext(); context.ProjectRepoMock.Setup( x => x.Update( It.Is<Project>( p => p.Id == 1 ) ) ); context.ProjectRepoMock.Setup( x => x.GetAll() ).Returns( Enumerable.Empty<Project>() ); context.SettingsRepoMock.Setup( x => x.GetById( "state.project" ) ).Returns( new Config { Id = "-1" } ); var vm = new ProjectListViewModel( context.ViewServiceRepo, context.SettingsRepo, context.ProjectRepo ) { CurrentProject = new ProjectViewModel( new Project { Id = 1 } ) }; // Act var tag = new Tag { Id = 123 }; vm.AddTag( tag ); // Assert Assert.IsNotNull( vm.CurrentProject.Model.Tags.SingleOrDefault( t => t.Id == tag.Id ) ); }
public void AddTag( Tag tag ) { CurrentProject.Model.Tags.Add( tag ); ProjectRepo.Update( CurrentProject.Model ); }
public TodoTagViewModel( Tag tag ) { Model = tag; }
public TagAddedMessage( Tag tag ) { Tag = tag; }
public TagRemovedMessage( Tag tag ) { Tag = tag; }
private void ExecuteNewTagCommand() { var tag = new Tag { Name = NewTagName, Project = ProjectList.CurrentProject.Model, Color = NewTagColor.ToString( CultureInfo.InvariantCulture ).Substring( 3 ) }; TagRepo.Add( tag ); ProjectList.AddTag( tag ); Tags.Add( new TagViewModel( tag ) ); Reset(); MessengerInstance.Send( new TagAddedMessage( tag ) ); }