예제 #1
0
        public void ValidSortExpressionWithoutSortingDirection()
        {
            var endPointDefinition = new VirtualRelationEndPointDefinition(
                _classDefinition, "Orders", false, CardinalityType.Many, "OrderNumber", MockRepository.GenerateStub <IPropertyInformation>());
            var relationDefinition = new RelationDefinition("Test", endPointDefinition, endPointDefinition);

            endPointDefinition.SetRelationDefinition(relationDefinition);

            var validationResult = _validationRule.Validate(relationDefinition);

            AssertMappingValidationResult(validationResult, true, null);
        }
예제 #2
0
        public void InvalidSortExpression()
        {
            var endPointDefinition = new VirtualRelationEndPointDefinition(
                _classDefinition,
                "Orders",
                false,
                CardinalityType.Many,
                "Test",
                PropertyInfoAdapter.Create(typeof(Customer).GetProperty("Orders")));
            var relationDefinition = new RelationDefinition("Test", endPointDefinition, endPointDefinition);

            endPointDefinition.SetRelationDefinition(relationDefinition);

            var validationResult = _validationRule.Validate(relationDefinition);

            var expectedMessage =
                "SortExpression 'Test' cannot be parsed: 'Test' is not a valid mapped property name. Expected the .NET property name of a property "
                + "declared by the 'Order' class or its base classes. Alternatively, to resolve ambiguities or to use a property declared by a mixin "
                + "or a derived class of 'Order', the full unique re-store property identifier can be specified.\r\n\r\n"
                + "Declaring type: Remotion.Data.DomainObjects.UnitTests.Mapping.TestDomain.Integration.Customer\r\nProperty: Orders";

            AssertMappingValidationResult(validationResult, false, expectedMessage);
        }
예제 #3
0
 public void RelationDefinition_NonNull()
 {
     _customerOrdersEndPoint.SetRelationDefinition(new RelationDefinition("Test", _customerOrdersEndPoint, _customerOrdersEndPoint));
     Assert.That(_customerOrdersEndPoint.RelationDefinition, Is.Not.Null);
 }