Exemplo n.º 1
0
        public void GetsModCorrectly()
        {
            // Arrange
            var sut = new KerbalstuffApi(new CachingHttpService(_cache));

            // Act
            var result = sut.GetMod(493); // PlaneMode

            // Assert
            var latestVersion = result.Latest();

            Assert.That(result.id, Is.EqualTo(493));
            Assert.That(result.author, Is.Not.Null);
            Assert.That(result.background, Is.Not.Null);
            Assert.That(result.license, Is.Not.Null);
            Assert.That(result.name, Is.Not.Null);
            Assert.That(result.short_description, Is.Not.Null);
            Assert.That(result.source_code, Is.Not.Null);
            Assert.That(result.website, Is.Not.Null);
            Assert.That(result.versions.Length, Is.GreaterThan(0));
            Assert.That(latestVersion.changelog, Is.Not.Null);
            Assert.That(latestVersion.download_path, Is.Not.Null);
            Assert.That(latestVersion.friendly_version, Is.Not.Null);
            Assert.That(latestVersion.KSP_version, Is.Not.Null);
        }
Exemplo n.º 2
0
        public void ThrowsWhenModMissing()
        {
            // Arrange
            var sut = new KerbalstuffApi(new CachingHttpService(_cache));

            // Act
            TestDelegate act = () => sut.GetMod(-1);

            // Assert
            Assert.That(act, Throws.Exception.InstanceOf <Kraken>());
        }
Exemplo n.º 3
0
 // GH #816: Ensure URLs with & are encoded correctly.
 public string KS_URL_encode_816(string path)
 {
     return(KerbalstuffApi.ExpandPath(path).OriginalString);
 }