internal CatalogIndependentPackageDetails( string id = null, string version = null, string baseUri = null, string commitId = null, DateTimeOffset?commitTimeStamp = null, RegistrationPackageDeprecation deprecation = null) { var utc = commitTimeStamp ?? DateTimeOffset.UtcNow; Id = id ?? TestUtility.CreateRandomAlphanumericString(); var build = (int)(utc.Ticks & 0xff); // random number VerbatimVersion = version ?? $"1.0.{build}"; Version = version ?? VerbatimVersion; IdKeyword = $"{baseUri ?? "https://nuget.test/"}" + $"v3-catalog0/data/{utc.ToString(CatalogConstants.UrlTimeStampFormat)}" + $"/{Id.ToLowerInvariant()}.{Version.ToLowerInvariant()}.json"; TypeKeyword = new[] { CatalogConstants.PackageDetails, CatalogConstants.CatalogPermalink }; Authors = TestUtility.CreateRandomAlphanumericString(); CommitId = commitId ?? Guid.NewGuid().ToString("D"); CommitTimeStamp = utc.ToString(CatalogConstants.CommitTimeStampFormat); Created = utc.AddHours(-2).ToString(CatalogConstants.DateTimeFormat); Deprecation = deprecation; Description = TestUtility.CreateRandomAlphanumericString(); LastEdited = utc.AddHours(-1).ToString(CatalogConstants.DateTimeFormat); Listed = true; PackageHash = CreateFakePackageHash(); PackageHashAlgorithm = TestUtility.CreateRandomAlphanumericString(); PackageSize = (int)(utc.Ticks & 0xffffff); // random number Published = Created; RequireLicenseAcceptance = utc.Ticks % 2 == 0; PackageEntries = new[] { new CatalogPackageEntry( idKeyword: $"{IdKeyword}#{Id}.nuspec", typeKeyword: CatalogConstants.PackageEntry, compressedLength: (int)(utc.Ticks & 0xffff) + 1, fullName: $"{Id}.nuspec", length: (int)(utc.Ticks & 0xfff) + 1, name: $"{Id}.nuspec"), new CatalogPackageEntry( idKeyword: $"{IdKeyword}#.signature.p7s", typeKeyword: CatalogConstants.PackageEntry, compressedLength: (int)(utc.Ticks & 0xffff), fullName: ".signature.p7s", length: (int)(utc.Ticks & 0xfff), name: ".signature.p7s") }; ContextKeyword = _context; }
internal RegistrationPackageDetails( string idKeyword, string typeKeyword, string authors, RegistrationPackageDeprecation deprecation, string description, string iconUrl, string id, string language, string licenseUrl, bool listed, string minClientVersion, string packageContent, string projectUrl, string published, bool requireLicenseAcceptance, string summary, string[] tags, string title, string version) { IdKeyword = idKeyword; TypeKeyword = typeKeyword; Authors = authors; Deprecation = deprecation; Description = description; IconUrl = iconUrl; Id = id; Language = language; LicenseUrl = licenseUrl; Listed = listed; MinClientVersion = minClientVersion; PackageContent = packageContent; ProjectUrl = projectUrl; Published = published; RequireLicenseAcceptance = requireLicenseAcceptance; Summary = summary; Tags = tags; Title = title; Version = version; }