コード例 #1
0
        public void Should_Fail_Delete_If_Creds_Are_Invalid(string assetUri)
        {
            _server.Stub(x => x.Delete(assetUri))
            .WithStatus(HttpStatusCode.Unauthorized);

            var asset  = new ProGetAssetPusher(_log, _config);
            var result = Record.Exception(() => asset.DeleteAsset($"{Host}{assetUri}"));

            Assert.IsCakeException(result, "Authorization to ProGet server failed; Credentials were incorrect, or not supplied.");
        }
コード例 #2
0
        public void Should_Delete_Asset(string assetUri)
        {
            _server.Stub(x => x.Delete(assetUri))
            .OK();

            var asset  = new ProGetAssetPusher(_log, _config);
            var result = asset.DeleteAsset($"{Host}{assetUri}");

            Assert.True(result);
        }
        public void Should_Fail_Delete_If_Creds_Are_Invalid(string assetUri)
        {
            using (var server = FluentMockServer.Start())
            {
                server.Given(Request.Create().WithPath(assetUri).UsingDelete())
                .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.Unauthorized));

                var asset  = new ProGetAssetPusher(_log, _config);
                var result = Record.Exception(() => asset.DeleteAsset($"http://localhost:{server.Ports[0]}{assetUri}"));
                ExtraAssert.IsCakeException(result, "Authorization to ProGet server failed; Credentials were incorrect, or not supplied.");
            }
        }
        public void Should_Delete_Asset(string assetUri)
        {
            using (var server = FluentMockServer.Start())
            {
                server.Given(Request.Create().WithPath(assetUri).UsingDelete())
                .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK));

                var asset  = new ProGetAssetPusher(_log, _config);
                var result = asset.DeleteAsset($"http://localhost:{server.Ports[0]}{assetUri}");
                Assert.True(result);
            }
        }