Esempio n. 1
0
            public void CommitChanges()
            {
                var service = new TestableCuratedFeedService();

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                service.StubCuratedPackageRepository.Verify(r => r.CommitChanges(), Times.Once());
            }
Esempio n. 2
0
            public void DoesNotSetLaterIncompatiblePackageAsLatest()
            {
                var service = new TestableCuratedFeedService();

                var stubCuratedPackageVersion = new CuratedPackageVersion
                {
                    Key                    = 101,
                    Package                = service.StubPackage,
                    PackageKey             = service.StubPackage.Key,
                    CuratedFeed            = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeed,
                    CuratedFeedKey         = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeedKey,
                    CuratedPackage         = service.StubCuratedPackageRegistration_ForFeed1,
                    CuratedPackageKey      = service.StubCuratedPackageRegistration_ForFeed1.Key,
                    PackageRegistration    = service.StubPackage.PackageRegistration,
                    PackageRegistrationKey = service.StubPackage.PackageRegistrationKey
                };
                var stubCuratedPackageVersion_IncompatibleVersion = new CuratedPackageVersion
                {
                    Key                    = 101,
                    Package                = service.StubPackage_IncompatibleVersion,
                    PackageKey             = service.StubPackage_IncompatibleVersion.Key,
                    CuratedFeed            = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeed,
                    CuratedFeedKey         = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeedKey,
                    CuratedPackage         = service.StubCuratedPackageRegistration_ForFeed1,
                    CuratedPackageKey      = service.StubCuratedPackageRegistration_ForFeed1.Key,
                    PackageRegistration    = service.StubPackage_IncompatibleVersion.PackageRegistration,
                    PackageRegistrationKey = service.StubPackage_IncompatibleVersion.PackageRegistrationKey
                };

                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Add(stubCuratedPackageVersion);
                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Add(stubCuratedPackageVersion_IncompatibleVersion);

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                Assert.Same(service.StubPackage_IncompatibleVersion, service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Single(cpv => cpv.IsLatest).Package);

                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Remove(stubCuratedPackageVersion_IncompatibleVersion);

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                Assert.Same(service.StubPackage, service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Single(cpv => cpv.IsLatest).Package);
            }
            public void DoesNotSetLaterIncompatiblePackageAsLatest()
            {
                var service = new TestableCuratedFeedService();

                var stubCuratedPackageVersion = new CuratedPackageVersion
                {
                    Key = 101,
                    Package = service.StubPackage,
                    PackageKey = service.StubPackage.Key,
                    CuratedFeed = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeed,
                    CuratedFeedKey = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeedKey,
                    CuratedPackage = service.StubCuratedPackageRegistration_ForFeed1,
                    CuratedPackageKey = service.StubCuratedPackageRegistration_ForFeed1.Key,
                    PackageRegistration = service.StubPackage.PackageRegistration,
                    PackageRegistrationKey = service.StubPackage.PackageRegistrationKey
                };
                var stubCuratedPackageVersion_IncompatibleVersion = new CuratedPackageVersion
                {
                    Key = 101,
                    Package = service.StubPackage_IncompatibleVersion,
                    PackageKey = service.StubPackage_IncompatibleVersion.Key,
                    CuratedFeed = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeed,
                    CuratedFeedKey = service.StubCuratedPackageRegistration_ForFeed1.CuratedFeedKey,
                    CuratedPackage = service.StubCuratedPackageRegistration_ForFeed1,
                    CuratedPackageKey = service.StubCuratedPackageRegistration_ForFeed1.Key,
                    PackageRegistration = service.StubPackage_IncompatibleVersion.PackageRegistration,
                    PackageRegistrationKey = service.StubPackage_IncompatibleVersion.PackageRegistrationKey
                };

                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Add(stubCuratedPackageVersion);
                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Add(stubCuratedPackageVersion_IncompatibleVersion);

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                Assert.Same(service.StubPackage_IncompatibleVersion, service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Single(cpv => cpv.IsLatest).Package);

                service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Remove(stubCuratedPackageVersion_IncompatibleVersion);

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                Assert.Same(service.StubPackage, service.StubCuratedPackageRegistration_ForFeed1.CuratedPackageVersions.Single(cpv => cpv.IsLatest).Package);
            }
            public void CommitChanges()
            {
                var service = new TestableCuratedFeedService();

                service.UpdateIsLatest(service.StubPackageRegistration_ForFeed1, true);

                service.StubCuratedPackageRepository.Verify(r => r.CommitChanges(), Times.Once());
            }