public void SetupBeforeEach() { m_GameObject = new GameObject("blank"); m_ConditionsRoot = m_GameObject.AddComponent <TestMRObject>(); m_Db.GetTraitProvider(out m_FloatTraits); // clear and repopulate the database with a standard set of test data before every test m_Db.Clear(); DatabaseTestData.PopulateDatabase(m_Db, 3); SlowTaskModule.instance.ClearTasks(); }
public void MatchRatingDataTransform_SingleEntry() { DatabaseTestData.PopulateDatabase(m_Db, 3); m_GameObject.AddTestFloatCondition(); m_GameObject.AddTestVector2Condition(0.9f); SetupObject(m_GameObject); // TODO - better test for this stage now that it filters indices MatchRatingDataTransform.RateConditionMatches(m_Conditions, m_TraitCache, m_ConditionRatings); Assert.AreEqual(7, m_ConditionRatings[typeof(float)][0].Count); Assert.AreEqual(7, m_ConditionRatings[typeof(Vector2)][0].Count); }
public void MatchRatingDataTransform_NonWorkingIndicesNotProcessed() { DatabaseTestData.PopulateDatabase(m_Db, 3); m_GameObject.AddTestFloatCondition(); m_GameObject.AddTestVector2Condition(0.9f); SetupObject(m_GameObject); var dataTransform = new MatchRatingDataTransform { WorkingIndices = new List <int> { 1 }, Input1 = new [] { m_Conditions, m_Conditions }, Input2 = new [] { m_TraitCache, m_TraitCache }, Output = new [] { m_ConditionRatings, new ConditionRatingsData(m_Conditions) }, }; dataTransform.Complete(); Assert.Zero(dataTransform.Output[0][typeof(float)][0].Count); // index 0 wasn't processed, so no matches Assert.Zero(dataTransform.Output[0][typeof(Vector2)][0].Count); // index 1 was processed, so has matches. That we expect 7 is calculated by hand from the test data. Assert.AreEqual(7, dataTransform.Output[1][typeof(float)][0].Count); Assert.AreEqual(7, dataTransform.Output[1][typeof(Vector2)][0].Count); }