Пример #1
0
        public void Epoch()
        {
            var v1 = new CKAN.Version("1.2.0");
            var v2 = new CKAN.Version("1:1.2.0");

            Assert.That(v1.IsLessThan(v2));
        }
Пример #2
0
 public CkanModule GeneratorRandomModule(
     KSPVersion ksp_version = null,
     List<RelationshipDescriptor> conflicts = null,
     List<RelationshipDescriptor> depends = null,
     List<RelationshipDescriptor> sugests = null,
     List<String> provides = null,
     string identifier = null,
     Version version = null)
 {
     var mod = new CkanModule
     {
         name = Generator.Next().ToString(CultureInfo.InvariantCulture),
         @abstract = Generator.Next().ToString(CultureInfo.InvariantCulture),
         identifier = identifier??Generator.Next().ToString(CultureInfo.InvariantCulture),
         spec_version = new Version(1.ToString(CultureInfo.InvariantCulture)),
         ksp_version = ksp_version ?? new KSPVersion("0." + Generator.Next()),
         version = version ?? new Version(Generator.Next().ToString(CultureInfo.InvariantCulture))
     };
     mod.ksp_version_max = mod.ksp_version_min = new KSPVersion(null);
     mod.conflicts = conflicts;
     mod.depends = depends;
     mod.suggests = sugests;
     mod.provides = provides;
     return mod;
 }
Пример #3
0
        public void Epoch()
        {
            var v1 = new CKAN.Version("1.2.0");
            var v2 = new CKAN.Version("1:1.2.0");

            Assert.That(v1.IsLessThan(v2));
        }
Пример #4
0
        public void Issue1076()
        {
            var v0 = new CKAN.Version("1.01");
            var v1 = new CKAN.Version("1.1");

            Assert.That(v1.IsEqualTo(v0));
        }
Пример #5
0
        public void ScanDlls()
        {
            string path = Path.Combine(ksp.GameData(), "Example.dll");

            Assert.IsFalse(ksp.Registry.IsInstalled("Example"), "Example should start uninstalled");

            File.WriteAllText(path, "Not really a DLL, are we?");

            ksp.ScanGameData();

            Assert.IsTrue(ksp.Registry.IsInstalled("Example"), "Example installed");

            Version version = ksp.Registry.InstalledVersion("Example");

            Assert.IsInstanceOf <DllVersion>(version, "DLL detected as a DLL, not full mod");

            // Now let's do the same with different case.

            string path2 = Path.Combine(ksp.GameData(), "NewMod.DLL");

            Assert.IsFalse(ksp.Registry.IsInstalled("NewMod"));
            File.WriteAllText(path2, "This text is irrelevant. You will be assimilated");

            ksp.ScanGameData();

            Assert.IsTrue(ksp.Registry.IsInstalled("NewMod"));
        }
Пример #6
0
        public CkanModule GeneratorRandomModule(
            KspVersion ksp_version = null,
            List <RelationshipDescriptor> conflicts = null,
            List <RelationshipDescriptor> depends   = null,
            List <RelationshipDescriptor> sugests   = null,
            List <String> provides = null,
            string identifier      = null,
            Version version        = null)
        {
            var mod = new CkanModule
            {
                name         = Generator.Next().ToString(CultureInfo.InvariantCulture),
                @abstract    = Generator.Next().ToString(CultureInfo.InvariantCulture),
                identifier   = identifier ?? Generator.Next().ToString(CultureInfo.InvariantCulture),
                spec_version = new Version(1.ToString(CultureInfo.InvariantCulture)),
                ksp_version  = ksp_version ?? KspVersion.Parse("0." + Generator.Next()),
                version      = version ?? new Version(Generator.Next().ToString(CultureInfo.InvariantCulture))
            };

            mod.ksp_version_max = mod.ksp_version_min = null;
            mod.conflicts       = conflicts;
            mod.depends         = depends;
            mod.suggests        = sugests;
            mod.provides        = provides;
            return(mod);
        }
Пример #7
0
        public void Issue1076()
        {
            var v0 = new CKAN.Version("1.01");
            var v1 = new CKAN.Version("1.1");

            Assert.That(v1.IsEqualTo(v0));
        }
Пример #8
0
        public void AGExt()
        {
            var v1 = new CKAN.Version("1.20");
            var v2 = new CKAN.Version("1.22a");

            Assert.That(v2.IsGreaterThan(v1));
        }
Пример #9
0
        public void AGExt()
        {
            var v1 = new CKAN.Version("1.20");
            var v2 = new CKAN.Version("1.22a");

            Assert.That(v2.IsGreaterThan(v1));
        }
Пример #10
0
        public void Alpha()
        {
            var v1 = new CKAN.Version("apple");
            var v2 = new CKAN.Version("banana");

            // alphabetical test
            Assert.That(v1.IsLessThan(v2));
        }
Пример #11
0
        public void SortAllNonNumbersBeforeDot()
        {
            var v0 = new CKAN.Version("1.0_beta");
            var v1 = new CKAN.Version("1.0.1_beta");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Пример #12
0
 public void Complex()
 {
     var v1 = new CKAN.Version("v6a12");
     var v2 = new CKAN.Version("v6a5");
     Assert.That(v2.IsLessThan(v1));
     Assert.That(v1.IsGreaterThan(v2));
     Assert.That(! v1.IsEqualTo(v2));
 }
Пример #13
0
        public void UnevenVersioning()
        {
            var v0 = new CKAN.Version("1.1.0.0");
            var v1 = new CKAN.Version("1.1.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Пример #14
0
        public void Alpha()
        {
            var v1 = new CKAN.Version("apple");
            var v2 = new CKAN.Version("banana");

            // alphabetical test
            Assert.That(v1.IsLessThan(v2));
        }
Пример #15
0
        public void Complex()
        {
            var v1 = new CKAN.Version("v6a12");
            var v2 = new CKAN.Version("v6a5");

            Assert.That(v2.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v2));
            Assert.That(!v1.IsEqualTo(v2));
        }
Пример #16
0
        public void Basic()
        {
            var v0 = new CKAN.Version("1.2.0");
            var v1 = new CKAN.Version("1.2.0");
            var v2 = new CKAN.Version("1.2.1");

            Assert.That(v1.IsLessThan(v2));
            Assert.That(v2.IsGreaterThan(v1));
            Assert.That(v1.IsEqualTo(v0));
        }
Пример #17
0
        public void Basic()
        {
            var v0 = new CKAN.Version("1.2.0");
            var v1 = new CKAN.Version("1.2.0");
            var v2 = new CKAN.Version("1.2.1");

            Assert.That(v1.IsLessThan(v2));
            Assert.That(v2.IsGreaterThan(v1));
            Assert.That(v1.IsEqualTo(v0));
        }
Пример #18
0
        public void DotSeparatorForExtraData()
        {
            var v0 = new CKAN.Version("1.0");
            var v1 = new CKAN.Version("1.0.repackaged");
            var v2 = new CKAN.Version("1.0.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsLessThan(v2));
            Assert.That(v1.IsGreaterThan(v0));
            Assert.That(v2.IsGreaterThan(v1));
        }
Пример #19
0
        public void DotSeparatorForExtraData()
        {
            var v0 = new CKAN.Version("1.0");
            var v1 = new CKAN.Version("1.0.repackaged");
            var v2 = new CKAN.Version("1.0.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsLessThan(v2));
            Assert.That(v1.IsGreaterThan(v0));
            Assert.That(v2.IsGreaterThan(v1));
        }
Пример #20
0
        public void SpecCompareAssumptions()
        {
            // These are checks to make sure our assumptions regarding
            // spec versions hold.

            // The *old* CKAN spec had a version number of "1".
            // It should be accepted by any client with an old version number,
            // as well as any with a new version number.
            var old_spec = new CKAN.Version("1");
            var old_dev  = new CKAN.Version("v0.23");
            var new_dev  = new CKAN.Version("v1.2.3");

            Assert.IsTrue(old_dev.IsGreaterThan(old_spec));
            Assert.IsTrue(new_dev.IsGreaterThan(old_spec));

            // The new spec requires a minimum number (v1.2, v1.4)
            // Make sure our assumptions here hold, too.

            var readable_spec   = new CKAN.Version("v1.2");
            var unreadable_spec = new CKAN.Version("v1.4");

            Assert.IsTrue(new_dev.IsGreaterThan(readable_spec));
            Assert.IsFalse(new_dev.IsGreaterThan(unreadable_spec));
        }
Пример #21
0
        public void SortAllNonNumbersBeforeDot()
        {
            var v0 = new CKAN.Version("1.0_beta");
            var v1 = new CKAN.Version("1.0.1_beta");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Пример #22
0
 public NetkanOverride(JObject metadata)
 {
     this.metadata = (JObject) metadata.DeepClone();
     version = new Version(metadata["version"].ToString());
 }
Пример #23
0
        public void UnevenVersioning()
        {
            var v0 = new CKAN.Version("1.1.0.0");
            var v1 = new CKAN.Version("1.1.1");

            Assert.That(v0.IsLessThan(v1));
            Assert.That(v1.IsGreaterThan(v0));
        }
Пример #24
0
        public void SpecCompareAssumptions()
        {
            // These are checks to make sure our assumptions regarding
            // spec versions hold.

            // The *old* CKAN spec had a version number of "1".
            // It should be accepted by any client with an old version number,
            // as well as any with a new version number.
            var old_spec = new CKAN.Version("1");
            var old_dev = new CKAN.Version("v0.23");
            var new_dev = new CKAN.Version("v1.2.3");

            Assert.IsTrue(old_dev.IsGreaterThan(old_spec));
            Assert.IsTrue(new_dev.IsGreaterThan(old_spec));

            // The new spec requires a minimum number (v1.2, v1.4)
            // Make sure our assumptions here hold, too.

            var readable_spec = new CKAN.Version("v1.2");
            var unreadable_spec = new CKAN.Version("v1.4");

            Assert.IsTrue(new_dev.IsGreaterThan(readable_spec));
            Assert.IsFalse(new_dev.IsGreaterThan(unreadable_spec));
        }