Пример #1
0
        public void Crc24_OfNullFile_ThrowsArgumentNullException()
        {
            var storageAcces = new Crc24TestStorageAccess();

            StreamUtilities.Initialize(storageAcces);
            Assert.Throws <System.ArgumentNullException>(() => Crc24.OfFile(null));
        }
Пример #2
0
        public void Crc24_OfFile_IsCorrect()
        {
            // We use a privately defined type for the storage access to check initialize and remove, which will
            // hopefully guarantee that we use the expected storage during this test.
            var storageAcces = new Crc24TestStorageAccess();

            StreamUtilities.Initialize(storageAcces);
            var testFileName = "~/Crc24_OfFile_IsCorrect.dat";

            using (var fileStream = StreamUtilities.OpenFileStream(testFileName))
            {
                var testData = new byte[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
                fileStream.Write(testData, 0, testData.Length);
                var crc24 = Crc24.OfFile(testFileName);
                Assert.Equal(0x004F40DAu, crc24);
            }
        }