예제 #1
0
        public void GetsModCorrectly()
        {
            // Arrange
            var sut = new CurseApi(new CachingHttpService(_cache));

            // Act
            var result = sut.GetMod(220221); // MechJeb

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

            Assert.That(result.ModId, Is.EqualTo(220221));
            Assert.That(result.authors, Is.Not.Null);
            Assert.That(result.thumbnail, Is.Not.Null);
            Assert.That(result.license, Is.Not.Null);
            Assert.That(result.title, 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.files.Count, Is.GreaterThan(0));
            //Assert.That(latestVersion.changelog, Is.Not.Null);
            Assert.That(latestVersion.GetDownloadUrl(), Is.Not.Null);
            Assert.That(latestVersion.GetFileVersion(), Is.Not.Null);
            Assert.That(latestVersion.version, Is.Not.Null); // KSP Version
        }
예제 #2
0
        public void ThrowsWhenModMissing()
        {
            // Arrange
            var sut = new CurseApi(new CachingHttpService(_cache));

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

            // Assert
            Assert.That(act, Throws.Exception.InstanceOf <Kraken>());
        }
예제 #3
0
        public void GetsModCorrectly()
        {
            // Arrange
            var sut = new CurseApi(new CachingHttpService(_cache));

            // Act
            var result = sut.GetMod("photonsail");

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

            Assert.That(result.id, Is.EqualTo(296653));
            Assert.That(result.members, Is.Not.Null);
            Assert.That(result.thumbnail, Is.Not.Null);
            Assert.That(result.license, Is.Not.Null);
            Assert.That(result.title, Is.Not.Null);
            Assert.That(result.description, Is.Not.Null);
            Assert.That(result.files.Count, Is.GreaterThan(0));
            Assert.That(latestVersion.GetDownloadUrl(), Is.Not.Null);
            Assert.That(latestVersion.GetFileVersion(), Is.Not.Null);
            Assert.That(latestVersion.version, Is.Not.Null); // KSP Version
        }