当前位置: 首页>>代码示例>>C#>>正文


C# Package.ApplyEdit方法代码示例

本文整理汇总了C#中NuGetGallery.Package.ApplyEdit方法的典型用法代码示例。如果您正苦于以下问题:C# Package.ApplyEdit方法的具体用法?C# Package.ApplyEdit怎么用?C# Package.ApplyEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NuGetGallery.Package的用法示例。


在下文中一共展示了Package.ApplyEdit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyPackageEditUpdatesPackage

            public void ApplyPackageEditUpdatesPackage()
            {
                var p = new Package
                {
                    Title = "OldTitle",
                    Description = "OldDescription",
                    Summary = "OldSummary",
                    Tags = "OldTags",
                    FlattenedAuthors = "OldAuthors",
                    Copyright = "OldCopyright",
                    ReleaseNotes = "OldReleaseNotes",
                    Hash = "OldHash",
                    HashAlgorithm = "SHA512",
                    PackageFileSize = 0,
                };

                var pe = new PackageEdit
                {
                    Title = "NewTitle",
                    Description = "NewDescription",
                    Summary = "NewSummary",
                    Tags = "NewTags",
                    Authors = "NewAuthors",
                    Copyright = "NewCopyright",
                    ReleaseNotes = "NewReleaseNotes",
                };

                p.PackageEdits.Add(pe);
                p.ApplyEdit(pe, "SHA1024", "NewHash", 1);

                Assert.Equal(1, p.PackageHistories.Count);
                var h = p.PackageHistories.ElementAt(0);
                Assert.Equal("OldTitle", h.Title);
                Assert.Equal("OldDescription", h.Description);
                Assert.Equal("OldSummary", h.Summary);
                Assert.Equal("OldTags", h.Tags);
                Assert.Equal("OldAuthors", h.Authors);
                Assert.Equal("OldCopyright", h.Copyright);
                Assert.Equal("OldReleaseNotes", h.ReleaseNotes);
                Assert.Equal("SHA512", h.HashAlgorithm);
                Assert.Equal("OldHash", h.Hash);
                Assert.Equal(0, h.PackageFileSize);

                Assert.Equal("NewTitle", p.Title);
                Assert.Equal("NewDescription", p.Description);
                Assert.Equal("NewSummary", p.Summary);
                Assert.Equal("NewTags", p.Tags);
                Assert.Equal("NewAuthors", p.FlattenedAuthors);
                Assert.Equal("NewCopyright", p.Copyright);
                Assert.Equal("NewReleaseNotes", p.ReleaseNotes);
                Assert.Equal("SHA1024", p.HashAlgorithm);
                Assert.Equal("NewHash", p.Hash);
                Assert.Equal(1, p.PackageFileSize);

                Assert.Equal(1, p.PackageEdits.Count); // It has to be deleted from the ObjectContext anyway so no point trying to delete it as part of ApplyEdit.
            }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:56,代码来源:PackageFacts.cs


注:本文中的NuGetGallery.Package.ApplyEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。