Example #1
0
        private void SetupHuffmanEncodedBytesManagerMock()
        {
            encodedBytesReturnedByHuffmanEncodedBytesManager = ConstantsEncodingSystems.EncodedBytes1();

            huffmanEncodedBytesManagerMock
            .Setup(x => x.GetEncodedBytesFromByteStatistics(It.IsAny <List <ByteStatistics> >()))
            .Returns(encodedBytesReturnedByHuffmanEncodedBytesManager);
        }
Example #2
0
        public void GetEncodedBytesFromByteStatisticsReturnsExpectedNumberOfEncodedBytes()
        {
            var returnedEncodedBytes = huffmanEncodedBytesManager.GetEncodedBytesFromByteStatistics(ConstantsEncodingSystems.TextCharacterStatistics1);

            var comparer = new CompareLogic();

            comparer.Config.IgnoreProperty <EncodedByte>(x => x.EncodingBits);
            comparer.Config.IgnoreProperty <EncodedByte>(x => x.EncodedValue);
            Assert.IsTrue(comparer.Compare(ConstantsEncodingSystems.EncodedBytes1(), returnedEncodedBytes).AreEqual);
        }
Example #3
0
        public void Setup()
        {
            characterStatisticsFromMock = ConstantsEncodingSystems.TextCharacterStatistics1;
            encodedBytesFromMock        = ConstantsEncodingSystems.EncodedBytes1();

            huffmanReaderMock = new Mock <IHuffmanHeaderReader>();
            huffmanEncodedBytesManagerMock = new Mock <IHuffmanEncodedBytesManager>();
            fileReaderMock = new Mock <IFileReader>();
            fileWriterMock = new Mock <IFileWriter>();

            huffmanDecoder = new HuffmanDecoder(huffmanReaderMock.Object, huffmanEncodedBytesManagerMock.Object);

            SetupHuffmanReaderMock();
            SetupHuffmanEncodedBytesManagerMock();
            SetupFileReaderMock();
        }