コード例 #1
0
        public void For_collection_links_gracefully_fails()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();

            // Act
            var expression = convention.GetIdExpression((Author a) => a.Posts);

            // Assert
            Assert.Null(expression);
        }
コード例 #2
0
        public void For_absent_id_properties_gracefully_fails()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();

            // Act
            var expression = convention.GetIdExpression((Comment c) => c.Post);

            // Assert
            Assert.Null(expression);
        }
コード例 #3
0
        public void For_collection_links_gracefully_fails()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();

            // Act
            var expression = convention.GetIdExpression((Author a) => a.Posts);

            // Assert
            Assert.Null(expression);
        }
コード例 #4
0
        public void For_absent_id_properties_gracefully_fails()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();

            // Act
            var expression = convention.GetIdExpression((Comment c) => c.Post);

            // Assert
            Assert.Null(expression);
        }
コード例 #5
0
        public void For_existing_id_properties_returns_proper_expression()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();
            var post = new Post {AuthorId = 4};

            // Act
            var expression = convention.GetIdExpression((Post p) => p.Author);

            // Assert
            Assert.NotNull(expression);
            var compiled = expression.Compile();
            Assert.Equal(compiled(post), 4);
        }
コード例 #6
0
        public void For_existing_id_properties_returns_proper_expression()
        {
            // Arrange
            var convention = new SimpleLinkedIdConvention();
            var post       = new Post {
                AuthorId = 4
            };

            // Act
            var expression = convention.GetIdExpression((Post p) => p.Author);

            // Assert
            Assert.NotNull(expression);
            var compiled = expression.Compile();

            Assert.Equal(compiled(post), 4);
        }