public void Should_Fail_Existence_Check_If_Creds_Are_Invalid(string assetUri) { _server.Stub(x => x.Head(assetUri)) .WithStatus(HttpStatusCode.Unauthorized); var asset = new ProGetAssetPusher(_log, _config); var result = Record.Exception(() => asset.DoesAssetExist($"{Host}{assetUri}")); Assert.IsCakeException(result, "Authorization to ProGet server failed; Credentials were incorrect, or not supplied."); }
public void Should_Report_False_If_Asset_Does_Not_Exist(string assetUri) { _server.Stub(x => x.Head(assetUri)) .NotFound(); var asset = new ProGetAssetPusher(_log, _config); var result = asset.DoesAssetExist($"{Host}{assetUri}"); Assert.False(result); }
public void Should_Report_True_If_Asset_Exists(string assetUri) { _server.Stub(x => x.Head(assetUri)) .OK(); var asset = new ProGetAssetPusher(_log, _config); var result = asset.DoesAssetExist($"{Host}{assetUri}"); Assert.True(result); }
public void Should_Fail_Existence_Check_If_Creds_Are_Invalid(string assetUri) { using (var server = FluentMockServer.Start()) { server.Given(Request.Create().WithPath(assetUri).UsingHead()) .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.Unauthorized)); var asset = new ProGetAssetPusher(_log, _config); var result = Record.Exception(() => asset.DoesAssetExist($"http://localhost:{server.Ports[0]}{assetUri}")); ExtraAssert.IsCakeException(result, "Authorization to ProGet server failed; Credentials were incorrect, or not supplied."); } }
public void Should_Report_False_If_Asset_Does_Not_Exist(string assetUri) { using (var server = FluentMockServer.Start()) { server.Given(Request.Create().WithPath(assetUri).UsingHead()) .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.NotFound)); var asset = new ProGetAssetPusher(_log, _config); var result = asset.DoesAssetExist($"http://localhost:{server.Ports[0]}{assetUri}"); Assert.False(result); } }