Пример #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);
        }
Пример #2
0
        public void XmlElementKeyValueDataHandler_GetSecuredData_EmptySecuredProps_NonChangedResult()
        {
            //ARRANGE
            AbstractKeyValueDataHandler handler = new XmlElementKeyValueDataHandler();

            handler.Properties = new Dictionary <string, 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);
        }
Пример #3
0
        public void XmlElementKeyValueDataHandler_GetSecuredData_SomePropsNotInRequest_ListedParametresSecured()
        {
            //ARRANGE
            AbstractKeyValueDataHandler handler = new XmlElementKeyValueDataHandler();

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

            //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);
        }