Пример #1
0
        public void GetRelationshipType_Order_OrderDetail_Should_Return_ManyToOne()
        {
            // Arrange
            var             context = _fixture.GetContext();
            var             order   = new MockNorthwind().Orders[0];
            INavigationBase nav     = context.Entry(order).Navigation(nameof(order.OrderDetails)).Metadata;

            // Act
            RelationshipType?relType = nav.GetRelationshipType();

            // Assert
            Assert.Equal(RelationshipType.ManyToOne, relType);
        }
Пример #2
0
        public void GetRelationshipType_Customer_CustomerSetting_Should_Return_OneToOne()
        {
            // Arrange
            var context  = _fixture.GetContext();
            var customer = new MockNorthwind().Customers[0];

            customer.CustomerSetting = new CustomerSetting
            {
                CustomerId = customer.CustomerId,
                Customer   = customer,
                Setting    = "Setting 1"
            };
            INavigationBase nav = context.Entry(customer).Navigation(nameof(customer.CustomerSetting)).Metadata;

            // Act
            RelationshipType?relType = nav.GetRelationshipType();

            // Assert
            Assert.Equal(RelationshipType.OneToOne, relType);
        }