Exemple #1
0
        public void HandlersSpeedComparer_GetSecuredValue_UrlDataHandlers_ClearSecureData()
        {
            //ARRANGE
            string data            = "http://test.com?user=max&pass=123456&lang=rus&credit_card=660666&tel_number=89002223434";
            var    keyValueHandler = new UrlGetKeyValueDataHandler()
            {
                Properties = new Dictionary <string, string>
                {
                    { "user", "max" },
                    { "pass", "123456" },
                    { "lang", "rus" },
                    { "credit_card", "660666" },
                    { "tel_number", "89002223434" }
                }
            };

            var commonHandler = new UrlGetRequestDataHandler()
            {
                Properties = new [] { "user", "pass", "lang", "credit_card", "tel_number" }
            };

            //ACT
            var keyValueHandlerWorkTime = GetKeyValueHandlerExecutionTime(keyValueHandler, RepeatsNum, data);
            var commonHandlerWorkTime   = GetCommonHandlerExecutionTime(commonHandler, RepeatsNum, data);

            //ASSERT
            Assert.IsTrue(keyValueHandlerWorkTime < commonHandlerWorkTime);
        }
        public void UrlGetKeyValueDataHandler_GetSecuredData_EmptySecuredProps_NonChangedResult()
        {
            //ARRANGE
            AbstractKeyValueDataHandler handler = new UrlGetKeyValueDataHandler();

            handler.Properties = new Dictionary <string, string>();

            //ACT
            var result = handler.GetSecuredData("http://test.com?user=max&pass=123456");

            //ASSERT
            Assert.AreEqual("http://test.com?user=max&pass=123456", result);
        }
        public void UrlGetKeyValueDataHandler_GetSecuredData_SomePropsNotInRequest_ListedParametresSecured()
        {
            //ARRANGE
            AbstractKeyValueDataHandler handler = new UrlGetKeyValueDataHandler();

            handler.Properties = new Dictionary <string, string>
            {
                { "user", "max" },
                { "password", "123456" }
            };

            //ACT
            var result = handler.GetSecuredData("http://test.com?user=max&pass=123456");

            //ASSERT
            Assert.AreEqual("http://test.com?user=XXX&pass=123456", result);
        }