예제 #1
0
        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 ) );
        }
예제 #2
0
		public void AddTag( Tag tag )
		{
			CurrentProject.Model.Tags.Add( tag );
			ProjectRepo.Update( CurrentProject.Model );
		}
예제 #3
0
 public TodoTagViewModel( Tag tag )
 {
     Model = tag;
 }
예제 #4
0
 public TagAddedMessage( Tag tag )
 {
     Tag = tag;
 }
예제 #5
0
 public TagRemovedMessage( Tag tag )
 {
     Tag = tag;
 }
예제 #6
0
		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 ) );
		}