コード例 #1
0
            public async Task SerializesPage()
            {
                await Target.WriteLeafAsync(Hive, ReplicaHives, Id, Version, Leaf);

                var json = Encoding.UTF8.GetString(LegacyStream.ToArray());

                Assert.Equal("{}", json);
                LegacyContainer.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Once);
                LegacyContainer.Verify(x => x.GetBlobReference("nuget.versioning/1.0.0.json"), Times.Once);
                LegacyBlob.Verify(x => x.UploadFromStreamAsync(It.IsAny <Stream>(), It.IsAny <AccessCondition>()), Times.Once);
                LegacyBlob.Verify(x => x.UploadFromStreamAsync(It.IsAny <Stream>(), It.Is <AccessCondition>(a => a.IfMatchETag == null && a.IfNoneMatchETag == null)), Times.Once);
                GzippedContainer.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Never);
                SemVer2Container.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Never);
            }
コード例 #2
0
            public async Task DeletesBlobFromHivesAndReplicaHives()
            {
                ReplicaHives.Add(HiveType.Gzipped);
                ReplicaHives.Add(HiveType.SemVer2);

                await Target.DeleteUrlAsync(Hive, ReplicaHives, "https://example/reg/nuget.versioning/1.0.0.json");

                LegacyContainer.Verify(x => x.GetBlobReference("nuget.versioning/1.0.0.json"), Times.Once);
                GzippedContainer.Verify(x => x.GetBlobReference("nuget.versioning/1.0.0.json"), Times.Once);
                SemVer2Container.Verify(x => x.GetBlobReference("nuget.versioning/1.0.0.json"), Times.Once);
                LegacyBlob.Verify(x => x.DeleteIfExistsAsync(), Times.Once);
                GzippedBlob.Verify(x => x.DeleteIfExistsAsync(), Times.Once);
                SemVer2Blob.Verify(x => x.DeleteIfExistsAsync(), Times.Once);
            }
コード例 #3
0
            public async Task SerializesPage()
            {
                await Target.WritePageAsync(Hive, ReplicaHives, Id, Lower, Upper, Page);

                var json = Encoding.UTF8.GetString(LegacyStream.ToArray());

                Assert.Equal("{\"commitTimeStamp\":\"0001-01-01T00:00:00+00:00\",\"count\":0}", json);
                LegacyContainer.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Once);
                LegacyContainer.Verify(x => x.GetBlobReference("nuget.versioning/page/1.0.0/2.0.0.json"), Times.Once);
                LegacyBlob.Verify(x => x.UploadFromStreamAsync(It.IsAny <Stream>(), It.IsAny <AccessCondition>()), Times.Once);
                LegacyBlob.Verify(x => x.UploadFromStreamAsync(It.IsAny <Stream>(), It.Is <AccessCondition>(a => a.IfMatchETag == null && a.IfNoneMatchETag == null)), Times.Once);
                GzippedContainer.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Never);
                SemVer2Container.Verify(x => x.GetBlobReference(It.IsAny <string>()), Times.Never);
            }