예제 #1
0
        public async Task List_files()
        {
            // Arrange
            var files = new[]
            {
                new File("foo.txt", "abc", 8, "some foo", ContentEncoding.Utf8),
                new File("bar.txt", "def", 8, "some bar", ContentEncoding.Utf8)
            };
            var expected = new PagedResponse<File>(files, new RangeResponse(1, 2, 2));
            var connector = Mock.Of<IGalleryConnector>()
                .ThatGetsJson("/acme/sandboxes/john/vanilla/1.2.3/files/front", expected);
            var client = new SandboxesClient(connector);

            // Act
            var result = await client.ListFilesAsync("acme", "john", "vanilla", "1.2.3", "front", null, None);

            // Assert
            result.ShouldBe(expected);
        }
예제 #2
0
        public async Task List_files_with_all_parameters()
        {
            // Arrange
            var files = new[]
            {
                new File("foo.txt", "abc", 8, "some foo", ContentEncoding.Utf8),
                new File("bar.txt", "def", 8, "some bar", ContentEncoding.Utf8)
            };
            var expected = new PagedResponse<File>(files, new RangeResponse(1, 2, 2));
            var options = new AppFileListingOptions(new[] {"a", "b"}, 1, 2, true);
            var connector = Mock.Of<IGalleryConnector>()
                .ThatGetsJson("/acme/sandboxes/john/vanilla/1.2.3/files/front?f=a&f=b&_from=1&_to=2&content=true",
                    expected);
            var client = new SandboxesClient(connector);

            // Act
            var result = await client.ListFilesAsync("acme", "john", "vanilla", "1.2.3", "front", options, None);

            // Assert
            result.ShouldBe(expected);
        }