コード例 #1
0
	public void ProvideAction(TestUnit activePlayer) {
		if (Input.GetKey (KeyCode.W)) {
			activePlayer.Move (1);
			return;
		}
		if (Input.GetKey (KeyCode.E)) {
			activePlayer.Move (2);
			return;
		}
		if (Input.GetKey (KeyCode.D)) {
			activePlayer.Move (3);
			return;
		}
		if (Input.GetKey (KeyCode.X)) {
			activePlayer.Move (4);
			return;
		}
		if (Input.GetKey (KeyCode.Z)) {
			activePlayer.Move (5);
			return;
		}
		if (Input.GetKey (KeyCode.A)) {
			activePlayer.Move (6);
			return;
		}
		if (Input.GetKey (KeyCode.F)) {
			activePlayer.possibleAttack ();
			return;
		}
	}
コード例 #2
0
 public override void CreateGameObject(ObjectCreationRequest request)
 {
     if (request.ObjectType == typeof(TestUnit))
     {
         Random rnd = new Random();
         var item = new TestUnit(this.Bus) {
             Velocity = new Vect3(rnd.Next(-10, 10) * rnd.NextDouble(), rnd.Next(-10, 10) * rnd.NextDouble(), rnd.Next(-10, 10) * rnd.NextDouble()),
             TeamColour = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)),
             Selected = Convert.ToBoolean(rnd.Next(0, 1))
         };
         this.GameObjects.Add(item);
         Bus.Add(new ObjectCreated(request.TimeSent, item));
     }
     base.CreateGameObject(request);
 }
コード例 #3
0
ファイル: TestUnitService.cs プロジェクト: tomyqg/EPTS
 public async Task <bool> CreateTestUnit(TestUnit entity)
 {
     try
     {
         var result = false;
         _dataRepositories.TestUnitRepository.Add(entity);
         _dataRepositories.TestUnitRepository.Save();
         if (entity.TestUnitId != Guid.NewGuid())
         {
             result = true;
         }
         //entity.BusinessUnit =
         //    Task.Run(async () => await _dataRepositories.BusinessUnitRepository.GetById(entity.BusinessUnitId))
         //        .Result;
         return(await Task.FromResult(result));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #4
0
ファイル: ConsoleWrapper.cs プロジェクト: Carbonfrost/f-spec
        internal static void HeadlineColorFor(this IConsoleWrapper self, TestUnit unit)
        {
            switch (unit.Type)
            {
            case TestUnitType.Assembly:
                self.DarkCyan();
                self.Underline();
                break;

            case TestUnitType.Namespace:
                self.DarkCyan();
                break;

            case TestUnitType.Class:
                self.DarkGreen();
                break;

            case TestUnitType.Theory:
                break;
            }
        }
コード例 #5
0
ファイル: frmMains.cs プロジェクト: lilongs/AutoTestPlatform
        private void LoadEquipmentInfo()
        {
            string path = Application.StartupPath + "\\SysConfig";
            string json = JsonOperate.GetJson(path, "InstrumentClusterConfiguration.json");
            List <InstrumentClusterConfiguration> temp = JsonConvert.DeserializeObject <List <InstrumentClusterConfiguration> >(json);

            if (temp != null)
            {
                foreach (InstrumentClusterConfiguration equipment in temp)
                {
                    string   eq       = equipment.InstrumentCluster;
                    TestUnit testUnit = new TestUnit();
                    testUnit.Name = eq;
                    testUnit.Tag  = eq;
                    if (!DicEquipmentInfo.ContainsKey(eq))
                    {
                        DicEquipmentInfo.Add(eq, testUnit);
                    }
                }
            }
        }
コード例 #6
0
    public void LogTestStart(int currentStep, ExperimentContentType testType)
    {
        CurrentTest = new TestUnit()
        {
            TestStep  = currentStep,
            TestType  = testType,
            EventList = new List <TestEvent>(),
            Gender    = CurrentGender,
            TestTime  = System.DateTime.Now
        };
        CurrentTest.EventList.Add(new TestEvent()
        {
            Event = UnitTestEvent.Start,
            Time  = Time.realtimeSinceStartup
        });

        if (CurrentBirth != null)
        {
            CurrentTest.BirthDate = CurrentBirth.Value;
        }
    }
コード例 #7
0
        IEnumerable <TestData> ITestDataProvider.GetData(TestContext context)
        {
            TestUnit unit          = context.TestUnit;
            var      declaringType = ((TestTheory)unit).TestMethod.DeclaringType;
            var      all           = new List <IMemberAccessor>();

            foreach (var p in _properties)
            {
                var prop = declaringType.GetProperty(p, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
                if (prop == null)
                {
                    throw SpecFailure.CannotFindDataProperty(p);
                }

                if (prop.GetMethod == null)
                {
                    throw SpecFailure.DataPropertyIncorrectGetter();
                }
                all.Add(MemberAccessors.Property(prop));
            }
            return(this.WithNames(TestDataProvider.FromMemberAccessors(all).GetData(context), _tags.TestTags));
        }
コード例 #8
0
        public void TestQualifiedNamingScheme()
        {
            TestFramework framework = new TestFrameworkBuilder(Source, "Master Test Suite", 1).
                                      TestCase("test", 2).
                                      TestSuite("suite", 3).
                                      TestSuite("suite", 4).
                                      TestCase("test", 5).
                                      EndSuite().
                                      EndSuite().
                                      Build();

            // Master Test Suite fully qualified name is equivalent to the empty string
            Assert.That(framework.MasterTestSuite.FullyQualifiedName, Is.Empty);

            // Test Units which fall directly under the Master Test Suite will
            // have their (local) name equivalent to their fully qualified name
            foreach (TestUnit child in framework.MasterTestSuite.Children)
            {
                Assert.That(child.FullyQualifiedName, Is.EqualTo(child.Name));
            }

            // Test Fully Qualified Name scheme via lookup

            TestUnit test = Lookup(framework.MasterTestSuite, "test");

            AssertTestCase(test, 2, null, framework.MasterTestSuite);

            TestUnit suite = Lookup(framework.MasterTestSuite, "suite");

            AssertTestSuite(suite, 3, framework.MasterTestSuite);

            TestUnit suiteSuite = Lookup(framework.MasterTestSuite, "suite/suite");

            AssertTestSuite(suiteSuite, 4, suite);

            TestUnit suiteSuiteTest = Lookup(framework.MasterTestSuite, "suite/suite/test");

            AssertTestCase(suiteSuiteTest, 5, null, suiteSuite);
        }
コード例 #9
0
        public void Compare(double value1, TestUnit unit1, double value2, TestUnit unit2, int expected)
        {
            var v1 = new Measurement <TestUnit>(value1, unit1);
            var v2 = new Measurement <TestUnit>(value2, unit2);
            int rc = v1.CompareTo(v2);

            if (expected == 0)
            {
                rc.Should().Be(0);
                v1.Should().BeEquivalentTo(v2);
            }
            else if (expected > 0)
            {
                rc.Should().BeGreaterThan(0);
                v1.Equals(v2).Should().BeFalse();
            }
            else if (expected < 0)
            {
                rc.Should().BeLessThan(0);
                v1.Equals(v2).Should().BeFalse();
            }
        }
コード例 #10
0
ファイル: TestResult.cs プロジェクト: wellbeing2014/mywatcher
        //浏览模式 下一个 按钮
        void Button6Click(object sender, EventArgs e)
        {
            if (tp != null)
            {
                int sumtu = TestUnitDao.QueryTestUnitCount(tp.Moduleid, tp.Manageid, tp.Level, tp.State,
                                                           tp.Begintime, tp.Endtime);
                List <TestUnit> tulist = TestUnitDao.QueryTestUnit(tp.Moduleid, tp.Manageid, tp.Level, tp.State,
                                                                   tp.Begintime, tp.Endtime, tp.Startindex + 1, 1);
                if (tulist.Count > 0)
                {
                    this.tu = TestUnitDao.gettestUnitById(tulist[0].Id);
                    TestUnitBingData();
                    tp.Startindex = tp.Startindex + 1;
                    if (tp.Startindex - 1 < 0)
                    {
                        this.button5.Enabled = false;
                    }
                    else
                    {
                        this.button5.Enabled = true;
                    }

                    if (tp.Startindex + 2 > sumtu)
                    {
                        this.button6.Enabled = false;
                    }
                    else
                    {
                        this.button6.Enabled = true;
                    }
                }
                else
                {
                    MessageBox.Show("没有找到下一条数据", "出错");
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Generates a Visual Studio equivalent test case structure.
        /// </summary>
        /// <param name="testCase">The Boost.Test.TestCase to convert.</param>
        /// <returns>An equivalent Visual Studio TestCase structure to the one provided.</returns>
        private VSTestCase GenerateTestCase(TestCase testCase)
        {
            VSTestCase test = new VSTestCase(
                GetFullyQualifiedName(testCase),
                BoostTestExecutor.ExecutorUri,
                this.Source
                );

            test.DisplayName = testCase.Name;

            if (testCase.Source != null)
            {
                test.CodeFilePath = testCase.Source.File;
                test.LineNumber   = testCase.Source.LineNumber;
            }

            // Register the test suite as a trait
            test.Traits.Add(new Trait(VSTestModel.TestSuiteTrait, GetParentFullyQualifiedName(testCase)));

            TestUnit unit = testCase;

            while (unit != null)
            {
                foreach (string label in unit.Labels)
                {
                    // Register each and every label as an individual trait
                    test.Traits.Add(new Trait(VSTestModel.LabelTrait, ('@' + label)));
                }

                // Test cases inherit the labels of parent test units
                // Reference: http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/tests_organization/tests_grouping.html
                unit = unit.Parent;
            }

            return(test);
        }
コード例 #12
0
        private static TestUnit Row2TestUnit(DataRow row)
        {
            TestUnit test = new TestUnit();

            test.Id          = Int32.Parse(row["id"].ToString());
            test.Testcontent = row["testcontent"] as byte[];
            test.Adminid     = Int32.Parse(!(row["adminid"].ToString().Equals(""))?row["adminid"].ToString():"0");
            test.Moduleid    = Int32.Parse(!(row["moduleid"].ToString().Equals(""))?row["moduleid"].ToString():"0");
            test.Packageid   = Int32.Parse(!(row["packageid"].ToString().Equals(""))?row["packageid"].ToString():"0");
            test.Projectid   = Int32.Parse(!(row["projectid"].ToString().Equals(""))?row["projectid"].ToString():"0");
            test.Testorid    = Int32.Parse(!(row["testorid"].ToString().Equals(""))?row["testorid"].ToString():"0");
            test.Adminname   = row["adminname"].ToString();
            test.Buglevel    = row["buglevel"].ToString();
            test.Bugtype     = row["bugtype"].ToString();
            test.Modulename  = row["modulename"].ToString();
            test.Packagename = row["packagename"].ToString();
            test.Projectname = row["projectname"].ToString();
            test.State       = row["state"].ToString();
            test.Testorname  = row["testorname"].ToString();
            test.Testtime    = row["testtime"].ToString();
            test.Testtitle   = row["testtitle"].ToString();
            test.Unitno      = row["unitno"].ToString();
            return(test);
        }
コード例 #13
0
 public void Fail(string reason)
 {
     TestUnit.ForcePredeterminedStatus(TestUnitFlags.Failed, reason);
 }
コード例 #14
0
ファイル: FormICG.cs プロジェクト: veggeman/IceCreamGame
 private void btnTestShares_Click(object sender, EventArgs e)
 {
     TestUnit t = new TestUnit();
 }
コード例 #15
0
 /// <summary>
 /// Constructor. Initializes this qualified name based on the provided TestUnit.
 /// </summary>
 /// <param name="root">The TestUnit from which this qualified name is to be initialized.</param>
 public QualifiedNameBuilder(TestUnit root) :
     this()
 {
     Initialize(root);
 }
コード例 #16
0
 public IActionResult AddTestUnit([FromBody] TestUnit model)
 {
     unit_repo.Add(model);
     return(new OkObjectResult(new { TestUnitID = model.TestUnitId }));
 }
コード例 #17
0
	public void AddPlayer(TestUnit player) {
		playerL.Add (player);
	}
コード例 #18
0
ファイル: SelectView.cs プロジェクト: Beibarsov/UnityStrategy
 public void UpdateHP(int hp, TestUnit unit)
 {
     unit.GetComponentInChildren <Text>().text = "HP: " + hp;
 }
コード例 #19
0
 private void StartForm_Load(object sender, EventArgs e)
 {
     TestUnit = GetTestUnit();
 }
コード例 #20
0
 /// <summary>
 /// Asserts test suite details
 /// </summary>
 /// <param name="unit">The test suite to test</param>
 /// <param name="id">The expected Id of the test suite</param>
 /// <param name="parent">The expected parent of the test suite</param>
 private void AssertTestSuite(TestUnit unit, int id, TestUnit parent)
 {
     AssertTestUnit(unit, typeof(TestSuite), id, parent);
 }
コード例 #21
0
 protected TestExecutionContext(TestContext parent, TestUnit self, object testObject)
 {
     BaseContext = parent;
     _testUnit   = self;
     _testObject = testObject;
 }
コード例 #22
0
ファイル: TestClass.cs プロジェクト: Carbonfrost/f-spec
 protected virtual void BeforeTest(TestUnit test)
 {
 }
コード例 #23
0
ファイル: TestClass.cs プロジェクト: Carbonfrost/f-spec
 protected virtual void AfterTest(TestUnit test)
 {
 }
コード例 #24
0
 protected abstract TestExecutionContext CreateChildContext(TestUnit test);
コード例 #25
0
	void PlayerSelect() {
		if (Input.GetMouseButtonDown (0)) {
			mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);

			if (Physics.Raycast (mouseRay, out hit)) {
				if (hit.collider.tag.Equals ("Unit")) {
					if (activePlayer != null && activePlayer != hit.collider.gameObject.GetComponent<TestUnit>()) {
						activePlayer.GetComponentInChildren<ParticleSystem> ().Stop (true);
					}
					activePlayer = hit.collider.gameObject.GetComponent<TestUnit>();
				}
			}
		}
		}
コード例 #26
0
 public BasicDependUnit(TestUnit unit)
 {
     Assert.NotNull(unit);
     Assert.Equal("Hi", unit.TestValue);
 }
コード例 #27
0
	void Update() {
		if (playersTurn) {
			PlayerSelect ();
			if (activePlayer != null && activePlayer.Active) {
				if (!activePlayer.GetComponentInChildren<ParticleSystem> ().isPlaying) {
					activePlayer.GetComponentInChildren<ParticleSystem> ().Play (true);
					activePlayer.possibleMoves ();
				}
			} else if (activePlayer != null && !activePlayer.Active && !activePlayer.moving) {
				activePlayer.GetComponentInChildren<ParticleSystem> ().Stop(true);
			}

			if (activePlayer != null && activePlayer.Active && !activePlayer.moving) {
				playerInput.ProvideAction (activePlayer);
			}

			bool all_done = true;
			for (int i = 0; i < playerL.Count; i++) {
				if (playerL [i].Active || playerL [i].moving) {
					all_done = false;
					break;
				}
			}

			if (all_done) {
				playersTurn = false;
				enemiesTurn = true;
				activePlayer = null;

				foreach (Enemy enemy in enemyL) {
					enemy.Status = 1;
					enemy.ResetMovement ();
				}
			}
		} else if (enemiesTurn) {
			bool all_done = true;

			/*for (int i = 0; i < enemyL.Count; i++) {
				if (enemyL [i].Active) {
					bool aEnemyMoving = false;
					for (int j = 0; j < enemyL.Count; j++) {
						if (enemyL [j].moving) {
							aEnemyMoving = true;
						}
					}

					if (!aEnemyMoving) {
						enemyL [i].MoveEnemy ();
					}
				}
					
				if (enemyL [i].Active || enemyL [i].moving) {
					all_done = false;
				}
			}

			if (all_done) {
				playersTurn = true;
				enemiesTurn = false;

				foreach (TestUnit player in playerL) {
					player.Active = true;
					player.ResetMovement ();
				}
			}*/
		} 
	}
コード例 #28
0
ファイル: TestUnitResults.cs プロジェクト: Carbonfrost/f-spec
 internal TestUnitResults(TestUnit node)
 {
     _displayName = node.DisplayName;
     _type        = node.Type;
     _children    = new TestUnitResultCollection(this);
 }
コード例 #29
0
        /// <summary>
        /// Pushes the test unit on this structure.
        /// </summary>
        /// <param name="unit">The test unit to push</param>
        /// <returns>this</returns>
        public QualifiedNameBuilder Push(TestUnit unit)
        {
            Utility.Code.Require(unit, "unit");

            return(this.Push(unit.Name));
        }
コード例 #30
0
 public void Skip(string reason)
 {
     TestUnit.ForcePredeterminedStatus(TestUnitFlags.Skip, reason);
 }
コード例 #31
0
 public void Conversion2(double value, TestUnit unit, double expected, TestUnit unit1)
 {
     Measurement <TestUnit> .Convert(value, unit, unit1).Should().BeApproximately(expected, 1e-10);
 }
コード例 #32
0
 public void Pending(string reason)
 {
     TestUnit.ForcePredeterminedStatus(TestUnitFlags.Pending, reason);
 }
コード例 #33
0
        public void ConversionToString2(string text, string format, double value, TestUnit unit)
        {
            var m = new Measurement <TestUnit>(value, unit);

            m.ToString(format, CultureInfo.InvariantCulture).Should().Be(text);
        }
コード例 #34
0
 public DefaultTestContext(TestContext parent, TestUnit unit) : base(parent)
 {
     _unit = unit;
 }
コード例 #35
0
 public void Damage(TestUnit unit)
 {
     unit.TakeDamage(10);
     Main.Instance.SelectView.UpdateHP(unit.HPCounter(), unit);
 }
コード例 #36
0
 public void Pass(string message)
 {
     TestUnit.ForcePredeterminedStatus(TestUnitFlags.PassExplicitly, message);
 }