public void Should_Get_List_Of_Assets_Recursive(string assetDirectoryUri) { const string jsonList = @"[ { ""name"": ""integration-tests"", ""type"": ""dir"", ""created"": ""2017-10-25T20:22:48.533Z"", ""modified"": ""2017-10-25T20:22:48.503Z"" }, { ""name"": ""test-resources-0.1.2.zip"", ""parent"": ""integration-tests"", ""size"": 383814131, ""type"": ""application/x-zip-compressed"", ""sha1"": ""868541f2c06a18ce9c159a709b18629c1a3b89d7"", ""created"": ""2017-10-31T21:59:20.81Z"", ""modified"": ""2017-10-31T21:59:20.81Z"" } ]"; _server.Stub(x => x.Get($"{assetDirectoryUri}")) .WithParams(new Dictionary <string, string> { { "recursive", "true" } }) .Return(jsonList) .OK(); var asset = new ProGetAssetDirectoryLister(_config); var result = asset.ListDirectory($"{Host}{assetDirectoryUri}", true); Assert.Equal(2, result.Count); }
public void Should_Get_List_Of_Assets_Recursive(string assetDirectoryUri) { const string jsonList = @"[ { ""name"": ""integration-tests"", ""type"": ""dir"", ""created"": ""2017-10-25T20:22:48.533Z"", ""modified"": ""2017-10-25T20:22:48.503Z"" }, { ""name"": ""test-resources-0.1.2.zip"", ""parent"": ""integration-tests"", ""size"": 383814131, ""type"": ""application/x-zip-compressed"", ""sha1"": ""868541f2c06a18ce9c159a709b18629c1a3b89d7"", ""created"": ""2017-10-31T21:59:20.81Z"", ""modified"": ""2017-10-31T21:59:20.81Z"" } ]"; using (var server = FluentMockServer.Start()) { server.Given(Request.Create().WithPath(assetDirectoryUri).UsingGet()) .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK).WithBody(jsonList)); var asset = new ProGetAssetDirectoryLister(_config); var result = asset.ListDirectory($"http://localhost:{server.Ports[0]}{assetDirectoryUri}", true); Assert.Equal(2, result.Count); } }
public void Should_Get_List_Of_Assets_NonRecursive(string assetDirectoryUri) { const string jsonList = @"[ { ""name"": ""integration-tests"", ""type"": ""dir"", ""created"": ""2017-10-25T20:22:48.533Z"", ""modified"": ""2017-10-25T20:22:48.503Z"" } ]"; using (var server = FluentMockServer.Start()) { server.Given(Request.Create().WithPath(assetDirectoryUri).UsingGet()) .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK).WithBody(jsonList)); var asset = new ProGetAssetDirectoryLister(_config); var result = asset.ListDirectory($"http://localhost:{server.Ports[0]}{assetDirectoryUri}"); Assert.Single(result); } }
public void Should_Get_List_Of_Assets_NonRecursive(string assetDirectoryUri) { const string jsonList = @"[ { ""name"": ""integration-tests"", ""type"": ""dir"", ""created"": ""2017-10-25T20:22:48.533Z"", ""modified"": ""2017-10-25T20:22:48.503Z"" } ]"; _server.Stub(x => x.Get(assetDirectoryUri)) .WithParams(new Dictionary <string, string> { { "recursive", "false" } }) .Return(jsonList) .OK(); var asset = new ProGetAssetDirectoryLister(_config); var result = asset.ListDirectory($"{Host}{assetDirectoryUri}"); Assert.Single(result); }