コード例 #1
0
        private static ModTestDataPoint GenerateValidRandomizedTestDataPoint()
        {
            var random = new Random();

            String randomName = GenerateValidRandomizedModName();

            List <ModTitle> randomizedModTitles = new List <ModTitle>();

            for (int i = 0; i < random.Next(1, 6); i++)
            {
                randomizedModTitles.Add(ModTitleTestData.GenerateValidRandomizedModTitle());
            }

            List <Release> randomizedReleases = new List <Release>();

            for (int i = 0; i < random.Next(1, 6); i++)
            {
                randomizedReleases.Add(ReleaseTestData.GenerateValidRandomizedReleaseWithModName(randomName));
            }

            return(CreateTestDataPointFromProperties(
                       Name: randomName,
                       Titles: randomizedModTitles,
                       Releases: randomizedReleases
                       ));
        }
コード例 #2
0
        private static ReleaseTestDataPoint GenerateValidRandomizedTestDataPointWithModName(String modName)
        {
            var random = new Random();
            List <Dependency> randomizedDependencies = new List <Dependency>();

            for (int i = 0; i < random.Next(1, 6); i++)
            {
                randomizedDependencies.Add(DependencyTestData.GenerateValidRandomizedDependency());
            }

            String releaseFileNameString = ReleaseFileNameTestData.GenerateValidRandomizedReleaseFileNameStringWithModName(modName);
            Int32  underscoreIndex       = releaseFileNameString.LastIndexOf("_");
            String modVersionString      = releaseFileNameString.Substring(underscoreIndex + 1, releaseFileNameString.LastIndexOf(".zip") - (underscoreIndex + 1));

            return(CreateTestDataPointFromProperties(
                       ReleasedAt: ReleaseTestData.GenerateValidRandomizedReleasedAt(),
                       Sha1String: ReleaseTestData.GenerateValidRandomizedSha1String(),
                       ReleaseDownloadUrl: ReleaseDownloadUrl.For(ReleaseDownloadUrlTestData.GenerateValidRandomizedReleaseDownloadUrlStringWithModName(modName)),
                       ReleaseFileName: ReleaseFileName.For(releaseFileNameString),
                       ModVersion: ModVersion.For(modVersionString),
                       FactorioVersion: FactorioVersionTestData.GenerateValidRandomizedFactorioVersion(),
                       Dependencies: randomizedDependencies
                       ));
        }