Exemple #1
0
        public void With_Should_return_EntitySetBuilder()
        {
            using World world = new World();

            EntityRuleBuilder builder = world.GetEntities();

            Check.That(builder.WithEither <bool>().With <int>()).IsEqualTo(builder);
        }
        public void Copy_Should_return_different_instance()
        {
            using World world = new World();

            EntityRuleBuilder builder = world.GetEntities();
            EntityRuleBuilder copy    = builder.WithEither <bool>().Copy();

            Check.That(copy).IsNotEqualTo(builder);
        }
        public void Copy_Should_return_different_instance()
        {
            using World world = new World();

            EntityRuleBuilder builder = world.GetEntities().WithEither <bool>().WithoutEither <double>().With((in bool b) => b);
            EntityRuleBuilder copy    = builder.Copy();

            Check.That(copy).IsNotEqualTo(builder);

            using EntitySet s1 = builder.With <int>().AsSet();
            using EntitySet s2 = copy.Without <int>().AsSet();

            Entity e  = world.CreateEntity();
            Entity e1 = world.CreateEntity();
            Entity e2 = world.CreateEntity();

            e.Set(false);
            e1.Set(true);
            e1.Set(42);
            e2.Set(true);

            Check.That(s1.GetEntities().ToArray()).ContainsExactly(e1);
            Check.That(s2.GetEntities().ToArray()).ContainsExactly(e2);
        }