Esempio n. 1
0
        public void ZipRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem.zip");

            if (!File.Exists(filename))
            {
                ZipStoreSolarSystem();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

#pragma warning disable S125
            //// now serialize it to json file to inspect
            //filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem from zip.json");

            //if (File.Exists(filename))
            //    File.Delete(filename);

            //store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            //using StreamWriter writer = new StreamWriter(filename);
            //store.Store(map, writer);
#pragma warning restore S125

            IStellarMap generatedMap = SolarSystem.CreateSolSystem();

            Assert.IsTrue(BaseStellarMapEqualityComparer.Comparer.Equals(map as BaseStellarMap, generatedMap as BaseStellarMap));
        }
        public void ZipRetrieveLocalSector()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector.zip");

            if (!File.Exists(filename))
            {
                ZipStoreLocalSector();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);

            // now serialize it to json file to inspect
            filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSectorCheck.json");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(map, writer);
        }
Esempio n. 3
0
        public static void JsonRetrieveLocalSector()
        {
            string filename = Path.Combine(dataDir, "LocalSector.json");

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);

            Console.WriteLine(map.ToString());
        }
Esempio n. 4
0
        public static void RetrieveSolarSystem()
        {
            string filename = Path.Combine(dataDir, "SolarSystem.json");

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

            Console.WriteLine(map.ToString());
        }
        public void JsonRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector.json");

            if (!File.Exists(filename))
            {
                JsonStoreLocalSector();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);
        }
Esempio n. 6
0
        public void JsonRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem.json");

            if (!File.Exists(filename))
            {
                JsonStoreSolarSystem();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

            IStellarMap generatedMap = SolarSystem.CreateSolSystem();

            Assert.IsTrue(BaseStellarMapEqualityComparer.Comparer.Equals(map as BaseStellarMap, generatedMap as BaseStellarMap));
        }