Exemple #1
0
        public void TestDouble()
        {
            double input = 1;

            ByteToStringConverter converter = new ByteToStringConverter();
            string result = (string)converter.Convert(input, typeof(double), null, null);

            Assert.AreEqual("1 KB", result);
        }
Exemple #2
0
        public void TestLargeInt()
        {
            int input = 100000000;

            ByteToStringConverter converter = new ByteToStringConverter();
            string result = (string)converter.Convert(input, typeof(double), null, null);

            Assert.AreEqual("95.37 MB", result);
        }
        public void ConvertShouldConvertBytesToHexRepresentation()
        {
            var btsc           = new ByteToStringConverter();
            var input          = new byte[] { 0x11, 0x22, 0x33, 0xFF };
            var expectedOutput = "112233ff";

            var convertedBytes = btsc.Convert(input);

            Assert.AreEqual(expectedOutput, convertedBytes);
        }
        public void ConvertEmptyInputShouldReturnEmptyString()
        {
            var btsc           = new ByteToStringConverter();
            var input          = new byte[] {};
            var expectedOutput = string.Empty;

            var convertedBytes = btsc.Convert(input);

            Assert.AreEqual(expectedOutput, convertedBytes);
        }
 public new void TestConvert1()
 {
     _converter.Convert((byte)42, null, null, null).Should().Be("42");
 }
        public string HashBytes(byte[] input)
        {
            var hash = _sha1.ComputeHash(input);

            return(_btsc.Convert(hash));
        }