Beispiel #1
0
        public void NoLen_ZeroLenArray()
        {
            byte[] arr = { };
            Debug.Assert(0 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr);

            Assert.AreEqual(string.Empty, result);
        }
Beispiel #2
0
        public void NoLen_OnePadding()
        {
            byte[] arr = AppendZeros(ToArray("abcd"), 1);
            Debug.Assert(5 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr);

            Assert.AreEqual("abcd", result);
        }
Beispiel #3
0
        public void NoLen_NoPadding()
        {
            byte[] arr = ToArray("abcd");
            Debug.Assert(4 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr);

            Assert.AreEqual("abcd", result);
        }
Beispiel #4
0
        public void Len_Normal()
        {
            byte[] arr = AppendZeros(ToArray("abcd"), 4);
            Debug.Assert(8 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr, 6);

            Assert.AreEqual("abcd", result);
        }
Beispiel #5
0
        public void NoLen_Utf8CharInString()
        {
            byte[] arr = AppendZeros(Prepend(new byte[] { 0xC3, 0x81 }, ToArray("bcd")), 4);
            Debug.Assert(9 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr);

            Assert.AreEqual("\u00C1bcd", result);
        }
Beispiel #6
0
        public void NoLen_OnlyManyZeros()
        {
            byte[] arr = { 0, 0, 0, 0, 0, 0, 0, 0 };
            Debug.Assert(8 == arr.Length, "!WAS: " + arr.Length);
            string result = BluesoleilUtils.FromNameString(arr);

            Assert.AreEqual(string.Empty, result);
        }