public void ShowNextPage_TwoObjectsWatchingForPagesCollectionChangedEventAndUserMovesToPageTwoAndFilteredPackagesReturnsLessThanExpectedPackagesDueToMatchingVersions_InvalidOperationExceptionNotThrownWhen()
        {
            CreateViewModel();
            viewModel.PageSize = 2;

            var package1 = new FakePackage("First", "0.1.0.0");
            var package2 = new FakePackage("Second", "0.2.0.0");
            var package3 = new FakePackage("Test", "0.3.0.0");
            var package4 = new FakePackage("Test", "0.4.0.0");

            var packages = new FakePackage[] {
                package1, package2, package3, package4
            };

            registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange(packages);

            viewModel.ReadPackages();
            CompleteReadPackagesTask();

            ClearReadPackagesTasks();
            bool collectionChangedEventFired = false;

            viewModel.Pages.CollectionChanged += (sender, e) => collectionChangedEventFired = true;
            viewModel.ShowNextPage();
            CompleteReadPackagesTask();

            var expectedPackages = new FakePackage[] {
                package4
            };

            PackageCollectionAssert.AreEqual(expectedPackages, viewModel.PackageViewModels);
            Assert.IsTrue(collectionChangedEventFired);
        }
        public void ShowNextPage_TwoObjectsWatchingForPagesCollectionChangedEventAndUserMovesToPageTwoAndFilteredPackagesReturnsLessThanExpectedPackagesDueToMatchingVersions_InvalidOperationExceptionNotThrownWhen()
        {
            CreateViewModel();
            viewModel.PageSize = 2;

            var package1 = new FakePackage()
            {
                Id          = "First",
                Description = "",
                Version     = new Version(0, 1, 0, 0)
            };
            var package2 = new FakePackage()
            {
                Id          = "Secon",
                Description = "",
                Version     = new Version(0, 2, 0, 0)
            };
            var package3 = new FakePackage()
            {
                Id          = "Test",
                Description = "",
                Version     = new Version(0, 3, 0, 0)
            };
            var package4 = new FakePackage()
            {
                Id          = "Test",
                Description = "",
                Version     = new Version(0, 4, 0, 0)
            };
            var packages = new FakePackage[] {
                package1, package2, package3, package4
            };

            packageManagementService.FakeActivePackageRepository.FakePackages.AddRange(packages);

            viewModel.ReadPackages();
            CompleteReadPackagesTask();

            ClearReadPackagesTasks();
            bool collectionChangedEventFired = false;

            viewModel.Pages.CollectionChanged += (sender, e) => collectionChangedEventFired = true;
            viewModel.ShowNextPage();
            CompleteReadPackagesTask();

            var expectedPackages = new FakePackage[] {
                package4
            };

            PackageCollectionAssert.AreEqual(expectedPackages, viewModel.PackageViewModels);
            Assert.IsTrue(collectionChangedEventFired);
        }