Esempio n. 1
0
        public void Test_CloneGraph_MiniGraph([Values] TestingMode mode)
        {
            var node0 = GraphModel.CreateNode <Type0FakeNodeModel>("Node0", Vector2.zero);
            var node1 = GraphModel.CreateNode <Type0FakeNodeModel>("Node1", Vector2.zero);

            GraphModel.CreateEdge(node0.Input0, node1.Output0);

            var newGraphAsset = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(CreatedGraphType, "Test_Copy");

            Assert.That(GetNodeCount(), Is.EqualTo(2));
            Assert.That(GetEdgeCount(), Is.EqualTo(1));
            var n0 = GetNode(0) as Type0FakeNodeModel;
            var n1 = GetNode(1) as Type0FakeNodeModel;

            Assert.NotNull(n0);
            Assert.NotNull(n1);
            Assert.That(n0.Input0, Is.ConnectedTo(n1.Output0));
            Assert.That(newGraphAsset.GraphModel.NodeModels.Count, Is.EqualTo(0));
            Assert.That(newGraphAsset.GraphModel.EdgeModels.Cast <EdgeModel>().Count(), Is.EqualTo(0));

            newGraphAsset.GraphModel.CloneGraph(GraphModel);

            Assert.That(newGraphAsset.GraphModel.NodeModels.Count, Is.EqualTo(2));
            Assert.That(newGraphAsset.GraphModel.EdgeModels.Cast <EdgeModel>().Count(), Is.EqualTo(1));
            var nn0 = newGraphAsset.GraphModel.NodeModels.Cast <NodeModel>().ElementAt(0) as Type0FakeNodeModel;
            var nn1 = newGraphAsset.GraphModel.NodeModels.Cast <NodeModel>().ElementAt(1) as Type0FakeNodeModel;

            Assert.NotNull(nn0);
            Assert.NotNull(nn1);
            Assert.AreNotEqual(nn0, n0);
            Assert.AreNotEqual(nn1, n1);
            Assert.That(nn0.Input0, Is.ConnectedTo(nn1.Output0));
        }
        public void CreateGraphAssetWithTemplateBuildsValidGraphModel()
        {
            var graphTemplate = new TestGraph();

            GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), graphTemplate.DefaultAssetName, graphTemplate);

            AssertIntegrity();
        }
        public virtual void SetUp()
        {
            Window    = EditorWindow.GetWindowWithRect <GtfoWindowTest>(k_WindowRect);
            GraphView = Window.GraphView;
            Helpers   = new TestEventHelpers(Window);

            if (CreateGraphOnStartup)
            {
                var graphAsset = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(CreatedGraphType, "Test");

                CommandDispatcher.Dispatch(new LoadGraphAssetCommand(graphAsset));
            }
        }
 public void SetUp()
 {
     m_Asset1 = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "Test1");
 }
        public void SetUp()
        {
            m_GraphAsset = GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "Test");

            m_GraphAsset.CreateGraph("Graph");
        }
        public void CreateGraphAssetBuildsValidGraphModel()
        {
            GraphAssetCreationHelpers <TestGraphAssetModel> .CreateInMemoryGraphAsset(typeof(ClassStencil), "test");

            AssumeIntegrity();
        }