Пример #1
0
        public void SetUp()
        {
            commonUri = new Uri("SplashScreenImage.jpg", UriKind.Relative);
            commonIOStore = new IOStorage(commonUri);

            // delete the file from previous test
            IOStorage.GetUserFileArea.DeleteFile(commonUri.OriginalString);

            // Create the file with one stream and load it with a different stream
            commonStream = new StorageStream(Application.GetResourceStream(commonUri).Stream);
            commonIOStore.Save(commonStream);
        }
Пример #2
0
        public void TestSaveRaw()
        {
            // Make sure the stream is at the beginning of the file
            commonStream.Position = 0;
            Uri uri = new Uri("TestFile.jpg", UriKind.Relative);
            IOStorage s = new IOStorage(uri);

            // Create a stream with image data
            byte[] buffer = new byte[commonStream.Length];
            commonStream.Read(buffer, 0, (int)commonStream.Length);

            s.Save(buffer, commonStream.Length);
            StorageStream strm = new StorageStream(s.Load());
            Assert.IsTrue(commonStream.Length == strm.Length);

            IOStorage.GetUserFileArea.DeleteFile(uri.OriginalString);
        }
Пример #3
0
        public void TestRemove()
        {
            // Make sure the stream is at the beginning of the file
            commonStream.Position = 0;
            Uri uri = new Uri("TestFile.jpg", UriKind.Relative);
            IOStorage s = new IOStorage(uri);

            // Create a stream with image data
            byte[] buffer = new byte[commonStream.Length];
            commonStream.Read(buffer, 0, (int)commonStream.Length);

            // save it then remove it.
            s.Save(buffer, commonStream.Length);
            s.Remove();
            StorageStream strm = new StorageStream(s.Load());
        }