public async Task UploadDirectory_DirectoryPathExists_ReturnsSkylink()
        {
            // Arrange
            using var httpClient = SetUpHttpClientThatReturns(HttpStatusCode.OK, JsonSerializer.Serialize(ValidUploadResponse));
            var webPortalClient = new SkynetWebPortal(httpClient);
            var fileProvider    = SetUpFileProvider();

            // Act
            var response = await webPortalClient.UploadDirectory(fileProvider, "");

            // Assert
            Assert.That(response, Is.EqualTo(Skylink.Parse(ValidUploadResponse.Skylink)));
        }
Пример #2
0
        public async Task UploadFile_FileInfoIsValidFile_ReturnsSkylink()
        {
            // Arrange
            using var httpClient = SetUpHttpClientThatReturns(HttpStatusCode.OK, JsonSerializer.Serialize(ValidUploadResponse));
            var webPortalClient = new SkynetWebPortal(httpClient);
            var fileMock        = new Mock <IFileInfo>().SetupValidFile();

            // Act
            var response = await webPortalClient.UploadFile(fileMock.Object);

            // Assert
            Assert.That(response, Is.EqualTo(Skylink.Parse(ValidUploadResponse.Skylink)));
        }
        public async Task DownloadFile_FromFileProvider_ExpectedMetadata()
        {
            // Arrange
            var skylink = Skylink.Parse("AAAox419FTqN04JIo3urNNtyxwY9i61cZVnbwNlhGluwOQ");

            // Act
            var content = await _skynetWebPortal.DownloadFile(skylink);

            var result = await content.ReadAsStringAsync();

            // Assert
            Assert.That(result == "This file is embedded into the assembly");
        }
Пример #4
0
 // Arrange + Act
 static void ParseCall() => Skylink.Parse(null);