Exemple #1
0
        public void HashThrowTest()
        {
            string TestHash  = TextToHash(HashText).Remove(0, 1);
            Param  TestParam = new Param();

            Assert.Throws <ArgumentException>(delegate {
                using Stream _ = Hashicon.GenerateAsStream(TestHash, TestParam);
            });
Exemple #2
0
        public void GenerateJpgStreamTest()
        {
            string TestHash  = TextToHash(HashText);
            Param  TestParam = new Param {
                RenderMode = Enums.RenderModeEnum.Jpg, Size = 1000
            };

            using MemoryStream TestStream   = Hashicon.GenerateAsStream(TestHash, TestParam) as MemoryStream;
            using FileStream TestFileStream = new FileStream(FilePathJpgStream, FileMode.OpenOrCreate, FileAccess.Write);

            byte[] TestBytes = TestStream.ToArray();
            TestFileStream.Write(TestBytes, 0, TestBytes.Length);
        }
Exemple #3
0
        public void GenerateJpgBase64Test()
        {
            string TestHash  = TextToHash(HashText);
            Param  TestParam = new Param {
                RenderMode = Enums.RenderModeEnum.Jpg, Size = 1000
            };

            string TestBase64 = Hashicon.GenerateAsBase64(TestHash, TestParam);

            Output.WriteLine(TestBase64);

            byte[] TestBytes = Convert.FromBase64String(TestBase64);
            using FileStream TestFileStream = new FileStream(FilePathJpgBase64, FileMode.OpenOrCreate, FileAccess.Write);

            TestFileStream.Write(TestBytes, 0, TestBytes.Length);
        }