Exemplo n.º 1
0
        public void GetComponent_TwoComponents()
        {
            var actors = ActorHelper.ActorsFrom("a0", "a1", "a2", "a3");
            var layer  = new Layer();

            layer.Edges.Add(new Edge(actors[0], actors[1]));
            layer.Edges.Add(new Edge(actors[2], actors[3]));

            foreach (var actor in actors.GetRange(0, 2))
            {
                var component = Connected
                                .GetComponent(layer, actor)
                                .OrderBy(a => a.Name);

                Assert.Collection(component,
                                  item => Assert.Equal(item, actors[0]),
                                  item => Assert.Equal(item, actors[1])
                                  );
            }

            foreach (var actor in actors.GetRange(2, 2))
            {
                var component = Connected
                                .GetComponent(layer, actor)
                                .OrderBy(a => a.Name);

                Assert.Collection(component,
                                  item => Assert.Equal(item, actors[2]),
                                  item => Assert.Equal(item, actors[3])
                                  );
            }
        }