Exemple #1
0
        public void validate_read_from_json_stream()
        {
            var name         = Assembly.GetExecutingAssembly().FullName;
            var assemblyName = new AssemblyName(name).Name;
            // create a JSON stream
            var stream = StreamFinder.GetFileStreamFromResources("Resources/fileiotest/position.txt", assemblyName);
            var pos    = FileIO.ReadFromJsonStream <Position>(stream);

            Assert.AreEqual(pos.X, 5);
            Assert.AreEqual(pos.Y, 10);
            Assert.AreEqual(pos.Z, 15);
            stream.Close();
        }
Exemple #2
0
        public void validate_copy_stream()
        {
            var name         = Assembly.GetExecutingAssembly().FullName;
            var assemblyName = new AssemblyName(name).Name;
            var stream1      = StreamFinder.GetFileStreamFromResources("Resources/streamfindertest/resourcefile.txt", assemblyName);
            var stream2      = StreamFinder.GetFileStream("file5.txt", FileMode.CreateNew);

            Assert.IsNotNull(stream1);
            FileIO.CopyStream(stream1, stream2);
            Assert.IsNotNull(stream2);
            Assert.AreEqual(stream1, stream2);
            stream1.Close();
            stream2.Close();
        }