public void Matches_GivenMatch_ShouldReturnExpected_(HttpMethods method, string match, bool expected)
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var result = method.Matches(match);

            //---------------Test Result -----------------------
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Serves an XDocument from the provided path, for the provided method
 /// </summary>
 /// <param name="queryPath"></param>
 /// <param name="doc"></param>
 /// <param name="method"></param>
 public void ServeDocument(string queryPath, XDocument doc, HttpMethods method = HttpMethods.Any)
 {
     AddHtmlDocumentHandler((p, s) =>
     {
         if (p.FullUrl != queryPath || !method.Matches(p.Method))
         {
             return(null);
         }
         Log("Serving html document at {0}", p.FullUrl);
         return(doc.ToString());
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Serves a JSON document with the provided data at the provided path for the
 /// provided method
 /// </summary>
 /// <param name="path"></param>
 /// <param name="data"></param>
 /// <param name="method"></param>
 public void ServeJsonDocument(string path, object data, HttpMethods method = HttpMethods.Any)
 {
     AddJsonDocumentHandler((p, s) =>
     {
         if (p.FullUrl != path || !method.Matches(p.Method))
         {
             return(null);
         }
         Log("Serving JSON document at {0}", p.FullUrl);
         return(data);
     });
 }
        public void Matches_GivenMatchingVerb_ShouldReturnTrue(HttpMethods method, string verb)
        {
            //--------------- Arrange -------------------

            //--------------- Assume ----------------

            //--------------- Act ----------------------
            var result = method.Matches(verb);

            //--------------- Assert -----------------------
            Expectations.Expect(result).To.Be.True();
        }