Exemplo n.º 1
0
        public void MakeASuccessfulDELETERequestTest()
        {
            try
            {
                TestRequester testRequester = new TestRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(testRequester, "http://MakeASuccessfulDELETERequestTest:3000");
                }

                WebRequest.RegisterPrefix("http://MakeASuccessfulDELETERequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK);

                testRequester.DELETE("/deleteSuccess");
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }