Пример #1
0
        public void Request_ConstantSubstitution_ExpectedValue()
        {
            Request request = new Request(new Uri(@"http://localhost/rest/user/login/"), HttpMethod.Get);

            request.Content = "{ \"email\":\"[email protected]\",\"password\":\"123456\"}";

            IRequestTokenizer tokenizer = new JsonTokenizer();
            TokenCollection   tokens    = tokenizer.ExtractTokens(request);

            List <IToken> email = tokens.GetByName("email");

            Assert.Single(email);

            ISubstitution substitution = new SubstituteConstant(email[0], "*****@*****.**");

            substitution.MakeSubstitution(null, request);

            tokens = tokenizer.ExtractTokens(request);
            email  = tokens.GetByName("email");
            Assert.Equal("*****@*****.**", email[0].Value);
        }