public void when_initialized() { Contexts contexts = null; ConfigsInitializationSystem configsInitializationSystem = null; before = () => { contexts = new Contexts(); configsInitializationSystem = new ConfigsInitializationSystem(contexts); configsInitializationSystem.Initialize(); }; it["Must create config component"] = () => { contexts.meta.configsEntity.should_not_be_null(); }; it["Must add path config component"] = () => { contexts.meta.configsEntity.hasPathConfig.should_be_true(); }; }
public void when_execute() { Contexts contexts = null; PathBuildingSystem pathBuildingSystem = null; Mock <IBoardFactory> boardFactoryMock = null; GameEntity pathCreatorEntity = null; GameEntity boardEntity = null; before = () => { contexts = new Contexts(); boardFactoryMock = new Mock <IBoardFactory>(); boardEntity = contexts.game.CreateEntity(); boardEntity.isBoard = true; boardFactoryMock.Setup(x => x.CreateBoard(It.IsAny <Contexts>())).Returns(boardEntity); pathBuildingSystem = new PathBuildingSystem(contexts, boardFactoryMock.Object); contexts.game.isPathCreator = true; var configsInitializationSystem = new ConfigsInitializationSystem(contexts); configsInitializationSystem.Initialize(); }; context["Adds one board"] = () => { before = () => { pathCreatorEntity = contexts.game.pathCreatorEntity; pathBuildingSystem.Execute(); }; it["Must create entity with board component"] = () => { IGroup <GameEntity> entities = contexts.game.GetGroup(GameMatcher.Board); entities.count.should_be(1); }; it["Must add board component to board entity"] = () => { boardEntity.isBoard.should_be_true(); }; it["Must add position component to board entity"] = () => { boardEntity.hasPosition.should_be_true(); }; it["Must add board id component to board entity"] = () => { boardEntity.hasBoardId.should_be_true(); }; it["Must add sync transform component"] = () => { boardEntity.isSyncTransform.should_be_true(); }; it["Must add new board id component"] = () => { pathCreatorEntity.hasNewBoardId.should_be_true(); }; }; }
public void when_execute() { Contexts contexts = null; AroundRotationSpawnSystem aroundRotationSpawnSystem = null; GameEntity firstEntity = null; GameEntity secondEntity = null; before = () => { contexts = new Contexts(); aroundRotationSpawnSystem = new AroundRotationSpawnSystem(contexts); var configInitializationSystem = new ConfigsInitializationSystem(contexts); configInitializationSystem.Initialize(); firstEntity = contexts.game.CreateEntity(); firstEntity.ReplaceAroundRotationEmitter(1f, Vector3.zero, Vector3.forward, 90f); firstEntity.ReplaceNextBoardId(1); secondEntity = contexts.game.CreateEntity(); secondEntity.ReplaceBoardId(1); contexts.time.ReplaceDeltaTime(0.1f); }; context["Spawn time has not come"] = () => { before = () => { aroundRotationSpawnSystem.Execute(); }; it["Must update time"] = () => { firstEntity.aroundRotationEmitter.time.should_be(0.9f); }; it["Should not add around rotation component"] = () => { firstEntity.hasAroundRotation.should_be_false(); }; it["Should not add angular velocity component"] = () => { firstEntity.hasAngularVelocity.should_be_false(); }; it["Should not add around rotation emitter component to second entity"] = () => { secondEntity.hasAroundRotationEmitter.should_be_false(); }; }; context["Spawn time has come"] = () => { before = () => { contexts.time.ReplaceDeltaTime(2f); aroundRotationSpawnSystem.Execute(); }; it["Must remove around rotation emitter component"] = () => { firstEntity.hasAroundRotationEmitter.should_be_false(); }; it["Must add around rotation component"] = () => { firstEntity.hasAroundRotation.should_be_true(); firstEntity.aroundRotation.point.should_be(Vector3.zero); firstEntity.aroundRotation.axis.should_be(Vector3.forward); firstEntity.aroundRotation.deltaAngle.should_be(90f); }; it["Must add angular velocity component"] = () => { firstEntity.hasAngularVelocity.should_be_true(); }; it["Must add around rotation emitter component to second entity"] = () => { secondEntity.hasAroundRotationEmitter.should_be_true(); secondEntity.aroundRotationEmitter.point.should_be(Vector3.zero); secondEntity.aroundRotationEmitter.axis.should_be(Vector3.forward); secondEntity.aroundRotationEmitter.deltaAngle.should_be(90f); }; }; }