Ejemplo n.º 1
0
        public void CreateMultipleRelationship()
        {
            using (var client = new NeoClient(URL, USER, PASSWORD, CONFIG))
            {
                client.Connect();

                var user1 = client.Add(new User {
                    Email = "FakeEmail1", FirstName = "FakeFirstName1", LastName = "FakeLastName1"
                });
                var user2 = client.Add(new User {
                    Email = "FakeEmail2", FirstName = "FakeFirstName2", LastName = "FakeLastName2"
                });

                var isCreated1 = client.CreateRelationship(
                    user1.Uuid,
                    user2.Uuid,
                    new RelationshipAttribute
                {
                    Direction = DIRECTION.INCOMING,
                    Name      = "BROTHER"
                });

                var isCreated2 = client.CreateRelationship(
                    user1.Uuid,
                    user2.Uuid,
                    new RelationshipAttribute
                {
                    Direction = DIRECTION.INCOMING,
                    Name      = "FAMILY"
                });

                isCreated1.Should().BeTrue();
                isCreated2.Should().BeTrue();
            }
        }
Ejemplo n.º 2
0
        public void MatchRelationship()
        {
            using (var client = new NeoClient(URL, USER, PASSWORD, CONFIG))
            {
                client.Connect();

                User user1 = client.Add(new User {
                    Email = "FakeEmail1", FirstName = "FakeFirstName1", LastName = "FakeLastName1"
                });
                User user2 = client.Add(new User {
                    Email = "FakeEmail2", FirstName = "FakeFirstName2", LastName = "FakeLastName2"
                });

                var relationship = new RelationshipAttribute
                {
                    Direction = DIRECTION.INCOMING,
                    Name      = "BROTHER"
                };

                bool isCreatedRelationship = client.CreateRelationship(
                    user1.Uuid,
                    user2.Uuid,
                    relationship
                    );

                bool isUpdatedRelatiionship = client.MergeRelationship(
                    uuidFrom: user1.Uuid,
                    uuidTo: user2.Uuid,
                    relationshipAttribute: relationship
                    );

                isCreatedRelationship.Should().BeTrue();
                isUpdatedRelatiionship.Should().BeTrue();
            }
        }
Ejemplo n.º 3
0
        public void DropRelationship()
        {
            using (var client = new NeoClient(URL, USER, PASSWORD, CONFIG))
            {
                client.Connect();

                var user1 = client.Add(new User {
                    Email = "FakeEmail1", FirstName = "FakeFirstName1", LastName = "FakeLastName1"
                });
                var user2 = client.Add(new User {
                    Email = "FakeEmail2", FirstName = "FakeFirstName2", LastName = "FakeLastName2"
                });

                var relationship = new RelationshipAttribute
                {
                    Direction = DIRECTION.INCOMING,
                    Name      = "BROTHER"
                };

                client.CreateRelationship(
                    user1.Uuid,
                    user2.Uuid,
                    relationship);

                bool result = client.DropRelationshipBetweenTwoNodes(
                    user1.Uuid,
                    user2.Uuid,
                    relationship);

                result.Should().BeTrue();
            }
        }
Ejemplo n.º 4
0
        public void CreateRelationshipWithProperties()
        {
            using (var client = new NeoClient(URL, USER, PASSWORD, CONFIG))
            {
                client.Connect();

                var user1 = client.Add(new User {
                    Email = "FakeEmail1", FirstName = "FakeFirstName1", LastName = "FakeLastName1"
                });
                var user2 = client.Add(new User {
                    Email = "FakeEmail2", FirstName = "FakeFirstName2", LastName = "FakeLastName2"
                });

                var isCreated1 = client.CreateRelationship(
                    user1.Uuid,
                    user2.Uuid,
                    new RelationshipAttribute
                {
                    Direction = DIRECTION.INCOMING,
                    Name      = "BROTHER"
                },
                    new Dictionary <string, object>()
                {
                    { "CreatedAt", DateTime.UtcNow },
                    { "Kinship_Level", 1 },
                    { "Name", "FakeName" }
                }
                    );

                isCreated1.Should().BeTrue();
            }
        }