예제 #1
0
        public void CompareTo_ShouldCompare_ReleaseVersions(int expected, string version, string otherVersion)
        {
            var release = new Release(new ReleaseContract {
                Version = version
            }, false, new Version());
            var other = new Release(new ReleaseContract {
                Version = otherVersion
            }, true, new Version());

            var result = release.CompareTo(other);

            result.Should().Be(expected);
        }
        public void CompareTo_WhenProvidedOlderRelease_ReturnsOne(DateTime left, DateTime right)
        {
            Release leftRelease = new Release(
                ReleasedAt: left,
                Sha1String: ReleaseTestData.TestModAlphaReleaseSha1String,
                ReleaseDownloadUrl: ReleaseDownloadUrlTestData.TestModDownloadUrl,
                ReleaseFileName: ReleaseFileNameTestData.TestModAlphaReleaseFileName,
                ModVersion: ModVersionTestData.TestModAlphaReleaseVersion,
                FactorioVersion: FactorioVersionTestData.ZeroPointSeventeen,
                Dependencies: DependencyTestData.TestModAlphaReleaseDependencies);

            Release rightRelease = new Release(
                ReleasedAt: right,
                Sha1String: ReleaseTestData.TestModAlphaReleaseSha1String,
                ReleaseDownloadUrl: ReleaseDownloadUrlTestData.TestModDownloadUrl,
                ReleaseFileName: ReleaseFileNameTestData.TestModAlphaReleaseFileName,
                ModVersion: ModVersionTestData.TestModAlphaReleaseVersion,
                FactorioVersion: FactorioVersionTestData.ZeroPointSeventeen,
                Dependencies: DependencyTestData.TestModAlphaReleaseDependencies);

            Assert.Equal(1, leftRelease.CompareTo(rightRelease));
        }