public void Create_WhenArgumentIsValid_ReturnsInstance() { var contextJObject = TestUtility.CreateCatalogContextJObject(); var commitItemJObject = TestUtility.CreateCatalogCommitItemJObject(_commitTimeStamp, _packageIdentity); var commitItem = CatalogCommitItem.Create(contextJObject, commitItemJObject); var entry = CatalogIndexEntry.Create(commitItem); Assert.Equal(_uri.AbsoluteUri, entry.Uri.AbsoluteUri); Assert.Equal(CatalogConstants.NuGetPackageDetails, entry.Types.Single()); Assert.Equal(commitItemJObject[CatalogConstants.CommitId].ToString(), entry.CommitId); Assert.Equal(_commitTimeStamp, entry.CommitTimeStamp.ToUniversalTime()); Assert.Equal(_packageId, entry.Id); Assert.Equal(_packageVersion, entry.Version); }
public void Create_WhenCommitItemIsNull_Throws() { var exception = Assert.Throws <ArgumentNullException>(() => CatalogIndexEntry.Create(commitItem: null)); Assert.Equal("commitItem", exception.ParamName); }