public void Any_constraint_params_sets_AndConstraint_to_empty_list()
        {
            var constraint = Constraint.Any(BasicConstraint, BasicConstraint, BasicConstraint);

            Assert.AreEqual(0, constraint.AsQueryConstraint().AndConstraint.Count);
            Assert.AreEqual(constraint.AsQueryConstraint().OrConstraint.Count, 3);
        }
        public void Any_constraint_enumerable_sets_AndConstraint_to_empty_list()
        {
            var constraint = Constraint.Any(new List <Constraint> {
                BasicConstraint
            });

            Assert.AreEqual(0, constraint.AsQueryConstraint().AndConstraint.Count);
            Assert.AreEqual(constraint.AsQueryConstraint().OrConstraint.Count, 1);
        }
Beispiel #3
0
        static void AddMinimapQuery <T>(InterestTemplate interest) where T : ISpatialComponentData
        {
            var minimapQuery = InterestQuery.Query(
                Constraint.All(
                    Constraint.Any(Constraint.Component(CommanderStatus.ComponentId),
                                   Constraint.Component(StrongholdStatus.ComponentId),
                                   Constraint.Component(HeadQuarters.ComponentId)),
                    Constraint.RelativeSphere(FixedParams.WorldInterestLimit)))
                               .FilterResults(Position.ComponentId,
                                              BaseUnitStatus.ComponentId,
                                              TransformInternal.ComponentId)
                               .WithMaxFrequencyHz(FixedParams.WorldInterestFrequency);

            interest.AddQueries <T>(minimapQuery);
        }
 public void Any_constraint_throws_if_enumerable_empty()
 {
     Assert.Throws <ArgumentException>(() => Constraint.Any(new List <Constraint>()));
 }