Example #1
0
        public void SetTheConnectorStrengthImplicit()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test connector"" to 0.2")) {
                Mock <IMyShipConnector> mockConnector = new Mock <IMyShipConnector>();
                test.MockBlocksOfType("test connector", mockConnector);

                test.RunUntilDone();

                mockConnector.VerifySet(b => b.PullStrength = 0.2f);
            }
        }
Example #2
0
        public void UnlockTheConnector()
        {
            using (ScriptTest test = new ScriptTest(@"unlock the ""test connector""")) {
                Mock <IMyShipConnector> mockConnector = new Mock <IMyShipConnector>();
                test.MockBlocksOfType("test connector", mockConnector);

                test.RunUntilDone();

                mockConnector.Verify(b => b.Disconnect());
            }
        }
Example #3
0
        public void TellTheConnectorToStopCollecting()
        {
            using (ScriptTest test = new ScriptTest(@"tell the ""test connector"" to stop collecting")) {
                Mock <IMyShipConnector> mockConnector = new Mock <IMyShipConnector>();
                test.MockBlocksOfType("test connector", mockConnector);

                test.RunUntilDone();

                mockConnector.VerifySet(b => b.CollectAll = false);
            }
        }
        public void IsTheLaserAntennaConnected()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Laser Antenna Connected: "" + the ""test laser"" is connected")) {
                Mock <IMyLaserAntenna> mockLaserAntenna = new Mock <IMyLaserAntenna>();
                test.MockBlocksOfType("test laser", mockLaserAntenna);
                mockLaserAntenna.Setup(b => b.Status).Returns(MyLaserAntennaStatus.Connected);
                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Laser Antenna Connected: True"));
            }
        }
        public void SetTheLaserAntennaRange()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test laser"" range to 2000")) {
                Mock <IMyLaserAntenna> mockLaserAntenna = new Mock <IMyLaserAntenna>();
                test.MockBlocksOfType("test laser", mockLaserAntenna);

                test.RunUntilDone();

                mockLaserAntenna.VerifySet(b => b.Range = 2000f);
            }
        }
        public void LockTheLaserAntenna()
        {
            using (ScriptTest test = new ScriptTest(@"lock the ""test laser""")) {
                Mock <IMyLaserAntenna> mockLaserAntenna = new Mock <IMyLaserAntenna>();
                test.MockBlocksOfType("test laser", mockLaserAntenna);

                test.RunUntilDone();

                mockLaserAntenna.VerifySet(b => b.IsPermanent = true);
            }
        }
Example #7
0
        public void TellTheConnectorToDrain()
        {
            using (ScriptTest test = new ScriptTest(@"tell the ""test connector"" to drain")) {
                Mock <IMyShipConnector> mockConnector = new Mock <IMyShipConnector>();
                test.MockBlocksOfType("test connector", mockConnector);

                test.RunUntilDone();

                mockConnector.VerifySet(b => b.ThrowOut = true);
            }
        }
Example #8
0
        public void SetTheAntennaRange()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test antenna"" range to 5000")) {
                Mock <IMyRadioAntenna> mockAntenna = new Mock <IMyRadioAntenna>();
                test.MockBlocksOfType("test antenna", mockAntenna);

                test.RunUntilDone();

                mockAntenna.VerifySet(b => b.Radius = 5000f);
            }
        }
        public void TurnOnTheCollector()
        {
            using (ScriptTest test = new ScriptTest(@"turn on the ""test collector""")) {
                Mock <IMyCollector> mockCollector = new Mock <IMyCollector>();
                test.MockBlocksOfType("test collector", mockCollector);

                test.RunUntilDone();

                mockCollector.VerifySet(b => b.Enabled = true);
            }
        }
        public void TellAssemblerToConsume()
        {
            using (ScriptTest test = new ScriptTest(@"tell the ""test assembler"" to consume")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);

                test.RunUntilDone();

                mockAssembler.VerifySet(b => b.Mode = MyAssemblerMode.Disassembly);
            }
        }
Example #11
0
        public void TurnOnTheAntenna()
        {
            using (ScriptTest test = new ScriptTest(@"turn on the ""test antenna""")) {
                Mock <IMyRadioAntenna> mockAntenna = new Mock <IMyRadioAntenna>();
                test.MockBlocksOfType("test antenna", mockAntenna);

                test.RunUntilDone();

                mockAntenna.VerifySet(b => b.EnableBroadcasting = true);
            }
        }
        public void SetPropertyWithDirectionAndValueWithoutProperty()
        {
            using (ScriptTest test = new ScriptTest(@"up the ""test beacon"" to 200")) {
                Mock <IMyBeacon> mockBeacon = new Mock <IMyBeacon>();
                test.MockBlocksOfType("test beacon", mockBeacon);

                test.RunUntilDone();

                mockBeacon.VerifySet(b => b.Radius = 200);
            }
        }
        public void SetTheLaserAntennaTargetImplicit()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test laser"" to ""1:2:3""")) {
                Mock <IMyLaserAntenna> mockLaserAntenna = new Mock <IMyLaserAntenna>();
                test.MockBlocksOfType("test laser", mockLaserAntenna);

                test.RunUntilDone();

                mockLaserAntenna.Verify(b => b.SetTargetCoords("GPS:Target:1:2:3:"));
            }
        }
Example #14
0
        public void SetTheAntennaText()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test antenna"" text to ""Hello World!""")) {
                Mock <IMyRadioAntenna> mockAntenna = new Mock <IMyRadioAntenna>();
                test.MockBlocksOfType("test antenna", mockAntenna);

                test.RunUntilDone();

                mockAntenna.VerifySet(b => b.HudText = "Hello World!");
            }
        }
        public void StopTheAssembler()
        {
            using (ScriptTest test = new ScriptTest(@"stop the ""test assembler""")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);

                test.RunUntilDone();

                mockAssembler.Verify(b => b.ClearQueue());
            }
        }
        public void TurnOnTheDecoy()
        {
            using (ScriptTest test = new ScriptTest(@"turn on the ""test decoy""")) {
                Mock <IMyDecoy> mockDecoy = new Mock <IMyDecoy>();
                test.MockBlocksOfType("test decoy", mockDecoy);

                test.RunUntilDone();

                mockDecoy.VerifySet(b => b.Enabled = true);
            }
        }
        public void GetAssemblerSteelPlateAmount()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Steel Plate Remaining: "" + ""test assembler"" ""steel plate"" amount")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);
                MockProductionQueue(mockAssembler, MockProductionItem("SteelPlate", 100));

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Steel Plate Remaining: 100"));
            }
        }
        public void IsAssemblerComplete()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Complete: "" + ""test assembler"" is complete")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);
                mockAssembler.Setup(b => b.IsQueueEmpty).Returns(true);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Complete: True"));
            }
        }
        public void IsAssemblerConsuming()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Supplying: "" + ""test assembler"" is consuming")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);
                mockAssembler.Setup(b => b.Mode).Returns(MyAssemblerMode.Disassembly);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Supplying: True"));
            }
        }
        public void unlockTheRotor()
        {
            using (ScriptTest test = new ScriptTest(@"unlock the ""rotor""")) {
                var mockRotor = new Mock <IMyMotorStator>();
                test.MockBlocksOfType("rotor", mockRotor);
                MockBlockDefinition(mockRotor, "LargeStator");

                test.RunUntilDone();

                mockRotor.VerifySet(b => b.RotorLock = false);
            }
        }
        public void ReverseWithoutProperty()
        {
            using (ScriptTest test = new ScriptTest(@"reverse the ""test piston""")) {
                Mock <IMyPistonBase> mockPiston = new Mock <IMyPistonBase>();
                test.MockBlocksOfType("test piston", mockPiston);
                mockPiston.Setup(p => p.Velocity).Returns(1);

                test.RunUntilDone();

                mockPiston.Verify(b => b.Reverse());
            }
        }
        public void GetJumpDriveLevel()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Jump Drive Level: "" + ""test jumpdrive"" level")) {
                Mock <IMyJumpDrive> mockJumpDrive = new Mock <IMyJumpDrive>();
                test.MockBlocksOfType("test jumpdrive", mockJumpDrive);
                mockJumpDrive.Setup(b => b.CurrentStoredPower).Returns(20f);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Jump Drive Level: 20"));
            }
        }
Example #23
0
        public void GetTheAntennaRange()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Antenna Range: "" + the ""test antenna"" range")) {
                Mock <IMyRadioAntenna> mockAntenna = new Mock <IMyRadioAntenna>();
                test.MockBlocksOfType("test antenna", mockAntenna);
                mockAntenna.Setup(b => b.Radius).Returns(10000f);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Antenna Range: 10000"));
            }
        }
        public void setTheRotorTorque()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""rotor"" torque to 2000")) {
                var mockRotor = new Mock <IMyMotorStator>();
                test.MockBlocksOfType("rotor", mockRotor);
                MockBlockDefinition(mockRotor, "LargeStator");

                test.RunUntilDone();

                mockRotor.VerifySet(b => b.Torque = 2000f);
            }
        }
        public void GetJumpDriveLimit()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Jump Drive Max Power: "" + ""test jumpdrive"" limit")) {
                Mock <IMyJumpDrive> mockJumpDrive = new Mock <IMyJumpDrive>();
                test.MockBlocksOfType("test jumpdrive", mockJumpDrive);
                mockJumpDrive.Setup(b => b.MaxStoredPower).Returns(100f);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Jump Drive Max Power: 100"));
            }
        }
        public void IsJumpDriveReady()
        {
            using (ScriptTest test = new ScriptTest(@"Print ""Jump Drive Ready: "" + ""test jumpdrive"" is ready")) {
                Mock <IMyJumpDrive> mockJumpDrive = new Mock <IMyJumpDrive>();
                test.MockBlocksOfType("test jumpdrive", mockJumpDrive);
                mockJumpDrive.Setup(b => b.Status).Returns(MyJumpDriveStatus.Ready);

                test.RunUntilDone();

                Assert.IsTrue(test.Logger.Contains("Jump Drive Ready: True"));
            }
        }
        public void MovePropertyWithDirectionWithoutProperty()
        {
            using (ScriptTest test = new ScriptTest(@"up the ""test beacon""")) {
                Mock <IMyBeacon> mockBeacon = new Mock <IMyBeacon>();
                test.MockBlocksOfType("test beacon", mockBeacon);
                mockBeacon.Setup(b => b.Radius).Returns(1000);

                test.RunUntilDone();

                mockBeacon.VerifySet(b => b.Radius = 2000);
            }
        }
        public void DestroyTenSteelPlate()
        {
            using (ScriptTest test = new ScriptTest(@"tell the ""test assembler"" to destroy 10 ""steel plate""")) {
                Mock <IMyAssembler> mockAssembler = new Mock <IMyAssembler>();
                test.MockBlocksOfType("test assembler", mockAssembler);

                test.RunUntilDone();

                mockAssembler.VerifySet(b => b.Mode = MyAssemblerMode.Disassembly);
                mockAssembler.Verify(b => b.AddQueueItem(MockBlueprint("SteelPlate"), (MyFixedPoint)10));
            }
        }
        public void IncrementPropertyWithAction()
        {
            using (ScriptTest test = new ScriptTest(@"set the ""test beacon"" range by 100")) {
                Mock <IMyBeacon> mockBeacon = new Mock <IMyBeacon>();
                test.MockBlocksOfType("test beacon", mockBeacon);
                mockBeacon.Setup(p => p.Radius).Returns(100);

                test.RunUntilDone();

                mockBeacon.VerifySet(b => b.Radius = 200);
            }
        }
        public void detachTheRotor()
        {
            using (ScriptTest test = new ScriptTest(@"detach the ""rotor""")) {
                var mockRotor = new Mock <IMyMotorStator>();
                test.MockBlocksOfType("rotor", mockRotor);
                MockBlockDefinition(mockRotor, "LargeStator");

                test.RunUntilDone();

                mockRotor.Verify(b => b.Detach());
            }
        }