예제 #1
0
        private string GetXml(BuildSettings build)
        {
            var xml = Encoding.UTF8.GetString(File.ReadAllBytes("Resources/file.xml"));

            xml = SignTools.SigXml(xml, Convert.FromBase64String(build.Pfx), build.CerPassword);
            return(xml);
        }
예제 #2
0
        public void ValidateSpecialCharactersFromXML()
        {
            var   build = new BuildSettings();
            Stamp stamp = new Stamp(build.Url, build.Token);
            var   xml   = File.ReadAllText("Resources/SpecialCharacters.xml");

            xml = SignTools.SigXml(xml, Convert.FromBase64String(build.Pfx), build.CerPassword);
            var response = stamp.TimbrarV1(xml);

            Assert.IsTrue(response.status == "success", "Result not expected. Error: " + response.message);
            Assert.IsFalse(string.IsNullOrEmpty(response.data.tfd), "Result not expected. Error: " + response.message);
        }
예제 #3
0
        public async Task Stamp_Test_ValidateSpecialCharactersFromXMLAsync()
        {
            var     build = new BuildSettings();
            StampV4 stamp = new StampV4(build.Url, build.Token);
            var     xml   = File.ReadAllText("Resources/SpecialCharacters.xml");

            xml = SignTools.SigXml(xml, Convert.FromBase64String(build.Pfx), build.CerPassword);
            var response = await stamp.TimbrarV1Async(xml, "*****@*****.**");

            Assert.True(response.status == "success", "Result not expected. Error: " + response.message);
            Assert.False(string.IsNullOrEmpty(response.data.tfd), "Result not expected. Error: " + response.message);
        }
예제 #4
0
        public void MultipleStampXMLV1byToken()
        {
            var   build        = new BuildSettings();
            var   resultExpect = false;
            int   iterations   = 10;
            Stamp stamp        = new Stamp(build.Url, build.Token);
            List <StampResponseV1> listXmlResult = new List <StampResponseV1>();

            for (int i = 0; i < iterations; i++)
            {
                string xml = Encoding.UTF8.GetString(File.ReadAllBytes("Resources/file.xml"));
                xml = SignTools.SigXml(xml, Convert.FromBase64String(build.Pfx), build.CerPassword);
                var response = (StampResponseV1)stamp.TimbrarV1(xml);
                listXmlResult.Add(response);
            }
            if (listXmlResult != null)
            {
                resultExpect = listXmlResult.FindAll(w => w.status == ResponseType.success.ToString() || w.message.Contains("72 horas")).Count == iterations;
            }

            Assert.IsTrue((bool)resultExpect);
        }