public void VersionCheck_Services_Invalid()
        {
            var services = new ServicesComponent();

            // A nonexisting Services component should result in an error.
            Assert.IsTrue(services.IsComponentAllowed(null));
        }
示例#2
0
        public void VersionCheck_Services_Invalid()
        {
            var services = new ServicesComponent();

            // The Services component does not override the base algorithm that always returns true.
            Assert.IsTrue(services.IsComponentAllowed(null));
        }
        public void VersionCheck_Services_Correct()
        {
            // set a fake assembly version for testing purposes
            var av       = new Version(3, 3, 3, 3);
            var services = new ServicesComponent {
                AssemblyVersion = av
            };

            Assert.IsTrue(services.IsComponentAllowed(av));

            // it is allowed to have a component with a higher version than the assembly
            Assert.IsTrue(services.IsComponentAllowed(new Version(av.Major, av.Minor, av.Build, av.Revision + 1)));
            Assert.IsTrue(services.IsComponentAllowed(new Version(av.Major, av.Minor, av.Build + 1, av.Revision)));
            Assert.IsTrue(services.IsComponentAllowed(new Version(av.Major, av.Minor + 1, av.Build, av.Revision)));
            Assert.IsTrue(services.IsComponentAllowed(new Version(av.Major + 1, av.Minor, av.Build, av.Revision)));

            // This is the edge case where the assembly version's _revision_ number (the 4th one)
            // is higher than the component version, which is allowed.
            Assert.IsTrue(services.IsComponentAllowed(new Version(av.Major, av.Minor, av.Build, av.Revision - 1)));

            Assert.IsFalse(services.IsComponentAllowed(new Version(av.Major, av.Minor, av.Build - 1)));
            Assert.IsFalse(services.IsComponentAllowed(new Version(av.Major, av.Minor - 1, av.Build)));
            Assert.IsFalse(services.IsComponentAllowed(new Version(av.Major - 1, av.Minor, av.Build)));
        }