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);
        }
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
        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);
        }
Exemplo n.º 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);
        }