public void should_indicate_left_outer_join_if_outer_join_is_specified()
        {
            var projectionAlias = new ProjectionAlias(_propertyAccessor, true);

            projectionAlias.Apply(_criteria);
            _criteria.AssertWasCalled(x => x.CreateAlias(Arg <string> .Is.Equal("Person"), Arg <string> .Is.Equal("Person"), Arg <JoinType> .Is.Equal(JoinType.LeftOuterJoin)));
        }
        public void should_indicate_inner_join_by_default()
        {
            var projectionAlias = new ProjectionAlias(_propertyAccessor);

            projectionAlias.Apply(_criteria);
            _criteria.AssertWasCalled(x => x.CreateAlias(Arg <string> .Is.Equal("Person"), Arg <string> .Is.Equal("Person"), Arg <JoinType> .Is.Equal(JoinType.InnerJoin)));
        }
        public void EqualityCheck()
        {
            var a = new ProjectionAlias(ReflectionHelper.GetAccessor <Case>(c => c.Person.Name));
            var b = new ProjectionAlias(ReflectionHelper.GetAccessor <Case>(c => c.Person.Name));

            a.ShouldEqual(b);
        }
        public void should_create_the_alias_with_the_property_name()
        {
            var projectionAlias = new ProjectionAlias(_propertyAccessor, false);

            projectionAlias.Apply(_criteria);
            _criteria.AssertWasCalled(x => x.CreateAlias(Arg <string> .Is.Equal("Person"), Arg <string> .Is.Equal("Person"), Arg <JoinType> .Is.Anything));
        }
        public void should_set_the_accessor_on_the_projection_alias()
        {
            var accessor        = ReflectionHelper.GetAccessor <Case>(x => x.Person.Created);
            var projectionAlias = ProjectionAlias.For(accessor, false).ElementAt(0);

            projectionAlias.PropertyAccessor.ShouldEqual(accessor);
        }
        public void GetHashCodeCheck()
        {
            var a = new ProjectionAlias(ReflectionHelper.GetAccessor <Case>(c => c.Person.Name));
            var b = new ProjectionAlias(ReflectionHelper.GetAccessor <Case>(c => c.Person.Name));

            a.GetHashCode().ShouldEqual(b.GetHashCode());
        }
        public void should_set_outer_join_on_the_projection_alias()
        {
            var accessor        = ReflectionHelper.GetAccessor <Case>(x => x.Person.Created);
            var projectionAlias = ProjectionAlias.For(accessor, false).ElementAt(0);

            projectionAlias.OuterJoin.ShouldEqual(false);

            projectionAlias = ProjectionAlias.For(accessor, true).ElementAt(0);
            projectionAlias.OuterJoin.ShouldEqual(true);
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Projection"/> class.
 /// </summary>
 /// <param name="dispatcher">The <see cref="IReverseCallDispatcher{TClientMessage, TServerMessage, TConnectArguments, TConnectResponse, TRequest, TResponse}"/> dispatcher to use to send requests to the head.</param>
 /// <param name="projectionDefinition">The <see cref="ProjectionDefinition" />.</param>
 /// <param name="alias">The alias of the Projection (if provided) from the Client.</param>
 /// <param name="hasAlias">A value indicating whether an alias was provided by the Client.</param>
 public Projection(
     IReverseCallDispatcher <ProjectionClientToRuntimeMessage, ProjectionRuntimeToClientMessage, ProjectionRegistrationRequest, ProjectionRegistrationResponse, ProjectionRequest, ProjectionResponse> dispatcher,
     ProjectionDefinition projectionDefinition,
     ProjectionAlias alias,
     bool hasAlias)
 {
     Definition  = projectionDefinition;
     _dispatcher = dispatcher;
     Alias       = alias;
     HasAlias    = hasAlias;
 }
        public void should_create_an_alias_for_a_chained_property()
        {
            var accessor = ReflectionHelper.GetAccessor <Case>(x => x.Person.Created);

            ProjectionAlias.For(accessor, false).ShouldHaveCount(1);
        }
        public void should_not_create_an_alias_for_a_simple_property()
        {
            var accessor = ReflectionHelper.GetAccessor <Case>(x => x.Condition);

            ProjectionAlias.For(accessor, false).ShouldHaveCount(0);
        }
 public void get_an_alias()
 {
     ClassUnderTest.Where(x => x.Person.Name);
     _alias = ClassUnderTest.Aliases.Single();
 }
 public void should_indicate_left_outer_join_if_outer_join_is_specified()
 {
     var projectionAlias = new ProjectionAlias(_propertyAccessor, true);
     projectionAlias.Apply(_criteria);
     _criteria.AssertWasCalled(x => x.CreateAlias(Arg<string>.Is.Equal("Person"), Arg<string>.Is.Equal("Person"), Arg<JoinType>.Is.Equal(JoinType.LeftOuterJoin)));
 }
 public void should_indicate_inner_join_by_default()
 {
     var projectionAlias = new ProjectionAlias(_propertyAccessor);
     projectionAlias.Apply(_criteria);
     _criteria.AssertWasCalled(x => x.CreateAlias(Arg<string>.Is.Equal("Person"), Arg<string>.Is.Equal("Person"), Arg<JoinType>.Is.Equal(JoinType.InnerJoin)));
 }
 public void should_create_the_alias_with_the_property_name()
 {
     var projectionAlias = new ProjectionAlias(_propertyAccessor, false);
     projectionAlias.Apply(_criteria);
     _criteria.AssertWasCalled(x=> x.CreateAlias(Arg<string>.Is.Equal("Person"), Arg<string>.Is.Equal("Person"), Arg<JoinType>.Is.Anything));
 }