public void TryMatchRelationType() { var dataSet = new RelationRatingTestData.SingleMatchUsingSameTrait(); var childTraits = new RelationTraitCache.ChildTraits <float>(dataSet.FloatTraitValues); var childTraitsList = new List <RelationTraitCache.ChildTraits <float> > { childTraits, childTraits }; var relationArray = new IRelation <float>[] { m_FloatRelation, m_FloatRelation }; var relationRatingsList = new List <Dictionary <RelationDataPair, float> >().Fill(2); var dataPairs = new [] { new RelationDataPair(0, 1), new RelationDataPair(1, 0) }; var memberRatings = new [] { // start with one of the members having no matches, to test the failure case TestUtils.RandomRatings(), new Dictionary <int, float>() }; // this index resetting is normally done by the function that wraps this function RelationRatingTransform.CurrentRelationPairIndex = 0; Assert.False(RelationRatingTransform.RateMatches(relationArray, childTraitsList, dataPairs, memberRatings, relationRatingsList)); // give the member with no matches some matches, which should result in the whole type passing memberRatings[1] = TestUtils.RandomRatings(); RelationRatingTransform.CurrentRelationPairIndex = 0; Assert.True(RelationRatingTransform.RateMatches(relationArray, childTraitsList, dataPairs, memberRatings, relationRatingsList)); VerifyRelationRatings(relationRatingsList[0], childTraits); VerifyRelationRatings(relationRatingsList[1], childTraits); }
public void TryMatchSingleRelation() { var dataSet = new RelationRatingTestData.SingleMatchUsingSameTrait(); // both members using the same trait is common - Distance & Elevation have both use "pose" var childTraits = new RelationTraitCache.ChildTraits <float>(dataSet.FloatTraitValues); var relationRatings = new Dictionary <RelationDataPair, float>(); // if one of the relation members has no matches, this relation can't match Assert.False(RelationRatingTransform.RateMatches(m_FloatRelation, childTraits, dataSet.MemberOneRatings, new Dictionary <int, float>(), relationRatings)); // once that same member has matches, we should be able to match this relation Assert.True(RelationRatingTransform.RateMatches(m_FloatRelation, childTraits, dataSet.MemberOneRatings, dataSet.MemberTwoRatings, relationRatings)); VerifyRelationRatings(relationRatings, childTraits); }