public void TestSystemOnNewEntityContainerInitialization()
        {
            var archetypes = new List <Archetype>()
            {
                new Archetype("Test")
                {
                    Components =
                    {
                        { typeof(ComponentBinding <ItemStorage>), new ComponentBinding <ItemStorage>() },
                    }
                },
            };

            var systems = new List <SystemConfiguration>()
            {
                new SystemConfiguration <ItemStorageSystem>()
            };

            var configuration = new ECSConfiguration(archetypes, systems, null);
            var scenario      = new TestScenario()
            {
                Configuration = configuration
            };
            var    ecs = TestInstaller.CreatTestRoot(scenario).ECS;
            Entity entity;

            Assert.That(ecs.TryCreateEntityFromArchetype("Test", out entity));

            var component = entity.GetComponent <ItemStorage>();

            Assert.That(component, Is.Not.Null);
            Assert.That(component.Items.Length, Is.EqualTo(SimulationConstants.SubsystemMaxItems));
            Assert.That(component.Items[0], Is.Not.Null);
        }
    public void BindInterfaces()
    {
        //Запускаем тестовый установщик
        TestInstaller.Install(Container);

        Container.BindInterfacesAndSelfTo <Player>().FromNewComponentOnNewPrefabResource("Characters/Character_model").AsSingle();
        Container.BindInterfacesAndSelfTo <MockEnemy>().AsSingle();
    }
示例#3
0
        public void TestValidateLeafInstallerWithInstaller()
        {
            var installer = new TestInstaller();

            bool actual = installer.ValidateLeafInstaller(_parentInstallers);

            Assert.True(actual);
        }
    public void BindInterfaces()
    {
        //Запускаем тестовый установщик
        TestInstaller.Install(Container);

        //Mock персонажей
        Container.Bind <IPlayer>().To <MockPlayer>().AsSingle();
        Container.Bind <IEnemy>().To <MockEnemy>().AsSingle();
    }
示例#5
0
        public async Task DownloadRenamingTests()
        {
            // Test mode off for this test
            Consts.TestMode = false;


            var inia = $@"[General]
                        gameName={Game.SkyrimSpecialEdition.MetaData().MO2ArchiveName}
                        gameFile=Data/Update.esm";

            var statea = (GameFileSourceDownloader.State) await DownloadDispatcher.ResolveArchive(inia.LoadIniString());

            var inib   = $@"[General]
                        gameName={Game.SkyrimSpecialEdition.MetaData().MO2ArchiveName}
                        gameFile=Data/Skyrim.esm";
            var stateb = (GameFileSourceDownloader.State) await DownloadDispatcher.ResolveArchive(inib.LoadIniString());

            var archivesa = new List <Archive>()
            {
                new Archive {
                    Hash = statea.Hash, Name = "Download.esm", State = statea
                }
            };

            var archivesb = new List <Archive>()
            {
                new Archive {
                    Hash = stateb.Hash, Name = "Download.esm", State = stateb
                }
            };

            if (Directory.Exists("DownloadTests"))
            {
                Utils.DeleteDirectory("DownloadTests");
            }
            Directory.CreateDirectory("DownloadTests");

            var inst = new TestInstaller(null, null, null, "DownloadTests", null);

            await inst.DownloadMissingArchives(archivesa, true);

            await inst.DownloadMissingArchives(archivesb, true);

            CollectionAssert.AreEqual(Directory.EnumerateFiles("DownloadTests").Select(Path.GetFileName).OrderBy(a => a).ToArray(),
                                      new string[]
            {
                @"Download.esm",
                @"Download.esm.xxHash",
                @"Download_f80ee6d109516018308f62e2c862b7f061987ac4a8c2327a101ac6b8f80ec4ae_.esm",
                @"Download_f80ee6d109516018308f62e2c862b7f061987ac4a8c2327a101ac6b8f80ec4ae_.esm.xxHash"
            }.OrderBy(a => a).ToArray());

            Consts.TestMode = true;
        }
示例#6
0
        public void Ctor_StoresProvidedArguments()
        {
            var          config            = new InstallationConfiguration("path");
            var          installer         = new TestInstaller();
            const string path              = "path";
            var          discoveredDetails = new AssemblyDetails(path, "binary.dll", typeof(TestInstaller));

            var dto = new ConfiguredInstallationManifest(config, installer, path, discoveredDetails);

            Assert.That(dto.InstallationConfiguration, Is.EqualTo(config));
            Assert.That(dto.SourceInstaller, Is.EqualTo(installer));
            Assert.That(dto.Path, Is.EqualTo(path));
            Assert.That(dto.DiscoveredDetails, Is.EqualTo(discoveredDetails));
        }
示例#7
0
        public void TestComponentCreationViaArchetype()
        {
            var configuration = new ECSConfiguration(new List <Archetype>()
            {
                AntivirusWorkstation.Archetype
            }, null, null);
            var scenario = new TestScenario()
            {
                Configuration = configuration
            };
            var ecs = TestInstaller.CreatTestRoot(scenario).ECS;

            Entity entity;

            ecs.TryCreateEntityFromArchetype(AntivirusWorkstation.Archetype, out entity);
        }
示例#8
0
        public void SetUp()
        {
            _parentInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };

            _parentInstallers = new List <TestCompositeInstaller>
            {
                _parentInstaller1,
            };

            _dummyInstaller1 = new TestInstaller();
            _dummyInstaller2 = new TestInstaller();
            _dummyInstaller3 = new TestInstaller();
        }
        public void SetUp()
        {
            _installer1 = new TestInstaller();

            _compositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
            _compositeInstaller2 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>
                {
                    _compositeInstaller1,
                },
            };

            _circularRefCompositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
            _circularRefCompositeInstaller1._leafInstallers.Add(_circularRefCompositeInstaller1);

            _parentInstallers1 = new List <TestCompositeInstaller>
            {
                _compositeInstaller1,
            };

            _dummyInstaller1 = new TestInstaller();
            _dummyInstaller2 = new TestInstaller();
            _dummyInstaller3 = new TestInstaller();

            _dummyCompositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
        }
示例#10
0
 public void CommonInstaller()
 {
     TestInstaller.Install(Container);
 }
示例#11
0
 public void cleanup()
 {
     TestInstaller.deinstall();
 }
示例#12
0
        public void initialize()
        {
            IContext context = TestInstaller.run();

            databaseManagerPrivate = new PrivateObject(context.DatabaseManager);
        }