Exemplo n.º 1
0
        public void DecodeWith1Param_GivenStringIsNullOrEmpty_ReturnsSpecifiedString()
        {
            var decoder         = new MyDecoder(string.Empty);
            var specifiedString = "The string is empty";


            Assert.IsTrue(decoder.Decode(null) == specifiedString && decoder.Decode(string.Empty) == specifiedString);
        }
Exemplo n.º 2
0
 public void LoadImage(string path)
 {
     decoder     = new MyDecoder(path);
     imgOriginal = decoder.Decode();
     OriginalDrawer?.Invoke(imgOriginal);
     filters = new Filterer(imgOriginal);
 }
Exemplo n.º 3
0
        public void DecodeWithNoParams_StringToDecodeIsNullOrEmpty_ReturnsSpecifiedString()
        {
            var decoder1        = new MyDecoder(null);
            var decoder2        = new MyDecoder(string.Empty);
            var specifiedString = "The string is empty";

            Assert.IsTrue(decoder1.Decode() == specifiedString && decoder2.Decode() == specifiedString);
        }
Exemplo n.º 4
0
        public void DecodeWithNoParams_StringToDecodeHasValue_ReturnsDecodedString()
        {
            var decoder  = new MyDecoder("2[abc]d3[a]");
            var expected = "abcabcdaaa";

            var result = decoder.Decode();

            Assert.IsTrue(expected == result);
        }
Exemplo n.º 5
0
        public void DecodeWith1Param_GivenStringIsValidString_ReturnsDecodedString()
        {
            var decoder     = new MyDecoder("");
            var givenString = "2[abc3[f]]";
            var expected    = "abcfffabcfff";

            var result = decoder.Decode(givenString);

            Assert.IsTrue(expected == result);
        }
Exemplo n.º 6
0
    void Decode(byte[] bytes)
    {
        int size = sizeof(int);

        byte[] encodedLengthBytes = bytes.Take(size).ToArray();
        byte[] encodedAudioBytes  = bytes.Skip(sizeof(int)).Take(bytes.Length - sizeof(int)).ToArray();
        int    length             = DecodeLength(encodedLengthBytes);

        decoder.Decode(encodedAudioBytes, length);
    }
Exemplo n.º 7
0
 private void UserInputText_TextChanged(object sender, EventArgs e)
 {
     this.ResultLable.Text = decoder.Decode(this.UserInputText.Text);
 }