public async Task LoadsPackageFromStream() { const string ContentDisposition = "example"; var stream = new HashingWriteStream("**no-file**", new MemoryStream(), HashAlgorithm.Create("SHA256")); var package = new TestPackage(); repositoryMock.Setup(r => r.LoadStagedPackage(stream)).Returns(package); var provider = formatter.CreateStreamProvider(); provider.AddStream(ContentDisposition, stream); var result = await formatter.ReadFormDataFromStreamAsync(provider); Assert.That(result, Is.SameAs(package)); }
protected LucenePackage MakeSamplePackage(string id, string version) { var p = new TestPackage { Id = id, Version = version != null ? new StrictSemanticVersion(version) : null, DownloadCount = -1, VersionDownloadCount = -1 }; if (p.Id != null && version != null) { p.Path = Path.Combine(packagePathResolver.Object.GetPackageDirectory(p), packagePathResolver.Object.GetPackageFileName(p)); } return p; }