Exemple #1
0
        public void GetClientIP()
        {
            //Arrange
            var request = new Mock <HttpRequestBase>();

            request.SetupGet(x => x.ServerVariables).Returns(() =>
            {
                NameValueCollection param = new NameValueCollection();
                param.Add("REMOTE_ADDR", "127.0.0.1");
                return(param);
            });
            string expected = "127.0.0.1";

            //Act
            RequestWrapper wrapper = new RequestWrapper(request.Object);
            string         result  = wrapper.GetClientIP();

            //Assert
            Assert.AreEqual(expected, result);
        }