public void ReadInChunks_MemoryConstraints_Does_Not_Corrupt_Content()
        {
            new BackGroundFileReader(_rawQueue, FileSystemMock, _partitionStreamMock)
            .ReadInChunks(GenFile.Path);

            var restoredByteArray     = ByteArrayHelper.ChunkCollectionToByteArray(_rawQueue);
            var _inputIsEqualToOutPut = ByteArrayHelper.AreEqual(GenFile.Content, restoredByteArray);

            Assert.True(_inputIsEqualToOutPut);
        }
        public void AreEqualTests()
        {
            Assert.True(ByteArrayHelper.AreEqual(null, null));
            Assert.False(ByteArrayHelper.AreEqual(null, new byte[0]));
            Assert.True(ByteArrayHelper.AreEqual(new byte[0], new byte[0]));

            Assert.False(ByteArrayHelper.AreEqual(Create(1, 2, 3), Create(1, 2)));
            Assert.True(ByteArrayHelper.AreEqual(Create(1, 2, 3), Create(1, 2, 3)));
            Assert.False(ByteArrayHelper.AreEqual(Create(1, 2, 3), Create(1, 3, 2)));
        }
Example #3
0
        public void Compress_Decompress_Bytes_Are_Equal()
        {
            var rawGenContent = CreateInputFile();

            Program.Main(new string[] { "compress", _rawFilePath, _compressedFilePath });

            Program.Main(new string[] { "decompress", _compressedFilePath, _decompressedFilePath });

            var decompresedContent = ReadUnZippedFile();
            var dataIsEqual        = ByteArrayHelper.AreEqual(rawGenContent, decompresedContent);

            Assert.True(dataIsEqual);
        }
Example #4
0
 public override bool Equals(Id3Frame other)
 {
     if (base.Equals(other))
     {
         return(true);
     }
     if (!(other is UnknownFrame unknownFrame))
     {
         return(false);
     }
     if (Id != unknownFrame.Id)
     {
         return(false);
     }
     return(ByteArrayHelper.AreEqual(Data, unknownFrame.Data));
 }
 public void GetBytesUptoSequenceTests(byte[] source, byte[] sequence, byte[] expectedResult)
 {
     Assert.True(ByteArrayHelper.AreEqual(ByteArrayHelper.GetBytesUptoSequence(source, 0, sequence), expectedResult));
 }
 public override bool Equals(Id3Frame other)
 {
     return(other is PrivateFrame privateFrame &&
            privateFrame.OwnerId == OwnerId &&
            ByteArrayHelper.AreEqual(privateFrame.Data, Data));
 }
Example #7
0
        public override bool Equals(Id3Frame other)
        {
            var privateFrame = other as PrivateFrame;

            return((privateFrame != null) && (privateFrame.OwnerId == OwnerId) && (ByteArrayHelper.AreEqual(privateFrame.Data, Data)));
        }