Exemplo n.º 1
0
        public void HandlersSpeedComparer_GetSecuredValue_XmlDataHandlers_ClearSecureData()
        {
            //ARRANGE
            string data            = "<auth><user>max</user><pass>123456</pass><lang>rus</lang><credit_card>660666</credit_card><tel_number>89002223434</tel_number></auth>";
            var    keyValueHandler = new XmlElementKeyValueDataHandler()
            {
                Properties = new Dictionary <string, string>
                {
                    { "user", "max" },
                    { "pass", "123456" },
                    { "lang", "rus" },
                    { "credit_card", "660666" },
                    { "tel_number", "89002223434" }
                }
            };

            var commonHandler = new XmlElementValueDataHandler()
            {
                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 override string GetSecuredData(string data)
        {
            var xmlAttrHandler = new XmlAttributeDataHandler {
                Properties = Properties
            };
            var xmlElemValueHandler = new XmlElementValueDataHandler {
                Properties = Properties
            };

            return(xmlAttrHandler.GetSecuredData(xmlElemValueHandler.GetSecuredData(data)));
        }
        public void XmlElementValueDataHandler_GetSecuredData_EmptySecuredProps_NonChangedResult()
        {
            //ARRANGE
            AbstractDataHandler handler = new XmlElementValueDataHandler();

            handler.Properties = new string[] { };

            //ACT
            var result = handler.GetSecuredData("<auth><user>max</user><pass>123456</pass></auth>");

            //ASSERT
            Assert.AreEqual("<auth><user>max</user><pass>123456</pass></auth>", result);
        }
        public void XmlElementValueDataHandler_GetSecuredData_SomePropsNotInRequest_ListedParametresSecured()
        {
            //ARRANGE
            AbstractDataHandler handler = new XmlElementValueDataHandler();

            handler.Properties = new string[] { "user", "first_name" };

            //ACT
            var result = handler.GetSecuredData("<auth><user>max</user><pass>123456</pass></auth>");

            //ASSERT
            Assert.AreEqual("<auth><user>XXX</user><pass>123456</pass></auth>", result);
        }