예제 #1
0
        public void WebGet_1(EngineState s)
        {
            string tempSrc  = CommandHashTests.SampleText();
            string tempDest = Path.GetTempFileName();

            File.Delete(tempDest);

            try
            {
                Uri    fileUri = new Uri(tempSrc);
                string rawCode = $"WebGet,\"{fileUri.AbsoluteUri}\",\"{tempDest}\"";
                EngineTests.Eval(s, rawCode, CodeType.WebGet, ErrorCheck.Success);

                Assert.IsTrue(File.Exists(tempDest));
                Assert.IsTrue(s.Variables["StatusCode"].Equals("200", StringComparison.Ordinal));
            }
            finally
            {
                if (File.Exists(tempSrc))
                {
                    File.Delete(tempSrc);
                }
                if (File.Exists(tempDest))
                {
                    File.Delete(tempDest);
                }
            }
        }
예제 #2
0
        public void WebGet_SHA384(EngineState s)
        {
            string tempSrc  = CommandHashTests.SampleText();
            string tempDest = Path.GetTempFileName();

            File.Delete(tempDest);

            try
            {
                Uri    fileUri = new Uri(tempSrc);
                string rawCode = $"WebGet,\"{fileUri.AbsoluteUri}\",\"{tempDest}\",SHA384=e068a3ac0b4ab4b37306dc354af6b8a4c89ef3fbbf1db969ec6d6a4281f1ab1f472fcd7bc2f16c0cf41c1991056846a6";
                EngineTests.Eval(s, rawCode, CodeType.WebGet, ErrorCheck.Success);

                Assert.IsTrue(File.Exists(tempDest));
                Assert.IsTrue(s.Variables["StatusCode"].Equals("200", StringComparison.Ordinal));
            }
            finally
            {
                if (File.Exists(tempSrc))
                {
                    File.Delete(tempSrc);
                }
                if (File.Exists(tempDest))
                {
                    File.Delete(tempDest);
                }
            }
        }
예제 #3
0
        public void WebGet_SHA512(EngineState s)
        {
            string tempSrc  = CommandHashTests.SampleText();
            string tempDest = Path.GetTempFileName();

            File.Delete(tempDest);

            try
            {
                Uri    fileUri = new Uri(tempSrc);
                string rawCode = $"WebGet,\"{fileUri.AbsoluteUri}\",\"{tempDest}\",SHA512=f5829cb5e052ab5ef6820630fd992acabb798512d21b5c5295fb81b88b74f3812863c0804e730f26e166b51d77eb5f1de200fd75913278522da78fbb269600cc";
                EngineTests.Eval(s, rawCode, CodeType.WebGet, ErrorCheck.Success);

                Assert.IsTrue(File.Exists(tempDest));
                Assert.IsTrue(s.Variables["StatusCode"].Equals("200", StringComparison.Ordinal));
            }
            finally
            {
                if (File.Exists(tempSrc))
                {
                    File.Delete(tempSrc);
                }
                if (File.Exists(tempDest))
                {
                    File.Delete(tempDest);
                }
            }
        }
예제 #4
0
        public void WebGet_SHA256(EngineState s)
        {
            string tempSrc  = CommandHashTests.SampleText();
            string tempDest = Path.GetTempFileName();

            File.Delete(tempDest);

            try
            {
                Uri    fileUri = new Uri(tempSrc);
                string rawCode = $"WebGet,\"{fileUri.AbsoluteUri}\",\"{tempDest}\",SHA256=3596bc5a263736c9d5b9a06e85a66ed2a866b457a44e5ed8548e504ca5599772";
                EngineTests.Eval(s, rawCode, CodeType.WebGet, ErrorCheck.Success);

                Assert.IsTrue(File.Exists(tempDest));
                Assert.IsTrue(s.Variables["StatusCode"].Equals("200", StringComparison.Ordinal));
            }
            finally
            {
                if (File.Exists(tempSrc))
                {
                    File.Delete(tempSrc);
                }
                if (File.Exists(tempDest))
                {
                    File.Delete(tempDest);
                }
            }
        }
예제 #5
0
        public void SHA512()
        {
            string      tempFile = CommandHashTests.SampleText();
            string      rawCode  = $"Hash,SHA512,{tempFile},%Dest%";
            EngineState s        = EngineTests.CreateEngineState();

            EngineTests.Eval(s, rawCode, CodeType.Hash, ErrorCheck.Success);

            string       dest = s.Variables["Dest"];
            const string comp = "f5829cb5e052ab5ef6820630fd992acabb798512d21b5c5295fb81b88b74f3812863c0804e730f26e166b51d77eb5f1de200fd75913278522da78fbb269600cc";

            Assert.IsTrue(dest.Equals(comp, StringComparison.Ordinal));

            File.Delete(tempFile);
        }