public void Disposing_Items_On_Project_Changed()
        {
            // creates a backlog list
            IEventAggregator aggregator = new ScrumFactory.Composition.EventAggregator();

            ViewModel.BacklogViewModel list = new ViewModel.BacklogViewModel(
                null,
                null,
                null,
                aggregator,
                null,
                null);

            // create a item and adds to the backlog list view model
            List<ViewModel.BacklogItemViewModel> items = new List<ViewModel.BacklogItemViewModel>();
            Mock<ViewModel.BacklogItemViewModel> itemVM = new Mock<ViewModel.BacklogItemViewModel>(
                null,
                null,
                aggregator,
                null,
                new Project() { Roles = new List<Role>() },
                new BacklogItem());
            items.Add(itemVM.Object);
            list.Items = items;

            // emulates a project change
            aggregator.Publish<Project>(ScrumFactoryEvent.ViewProjectDetails, new Project());

            itemVM.Verify(i => i.Dispose(), "Dispose was not called");
        }
        //[TestMethod]
        //public void Disposing_Sprints_On_Delete() {
        //    Mock<ViewModel.SprintViewModel> sprintVM;
        //    ViewModel.IterationPlanningViewModel list = PrepareSprintListViewModel(out sprintVM);
        //    // verify dispose on load command
        //    list.RemoveSprintCommand.Execute(sprintVM.Object);
        //    sprintVM.Verify(i => i.Dispose(), "Dispose was not called");
        //}
        private ViewModel.BacklogViewModel PrepareListViewModel(out Mock<ViewModel.BacklogItemViewModel> itemVM)
        {
            // creates a fake backlogservice
            Mock<Services.IBacklogService> backlogService = new Mock<Services.IBacklogService>();
            backlogService.Setup(b =>
                b.GetCurrentBacklog(It.IsAny<string>(), It.IsAny<short>(), DateTime.MinValue, DateTime.MinValue))
                .Returns(new List<BacklogItem>());

            // creates a immediate bg executor
            Mock<IBackgroundExecutor> executor = BackgroundExecutorMock.SetupExecutorForCollectionOf<BacklogItem>(null);
            BackgroundExecutorMock.SetupExecutorForAction(executor);

            // creates a backlog list
            IEventAggregator aggregator = new ScrumFactory.Composition.EventAggregator();

            ViewModel.BacklogViewModel list = new ViewModel.BacklogViewModel(
                backlogService.Object,
                null,
                executor.Object,
                aggregator,
                new Mock<IDialogService>().Object,
                null);

            // assign a project to the list (no items yet, so no dispose by now)
            aggregator.Publish<Project>(ScrumFactoryEvent.ViewProjectDetails, new Project());

            // create a item and adds to the backlog list view model
            List<ViewModel.BacklogItemViewModel> items = new List<ViewModel.BacklogItemViewModel>();
            itemVM = new Mock<ViewModel.BacklogItemViewModel>(
                null,
                null,
                aggregator,
                null,
                new Project() { Roles = new List<Role>() },
                new BacklogItem());
            items.Add(itemVM.Object);
            list.Items = items;

            return list;
        }