Example #1
0
        public void assign_a_given_id_setter_is_private()
        {
            var member      = ReflectionHelper.GetProperty <UserWithPrivateId>(x => x.Id);
            var theAssigner = new IdAssigner <UserWithPrivateId, Guid>(member, new GuidIdGeneration());
            var user        = new UserWithPrivateId();
            var id          = Guid.NewGuid();

            theAssigner.Assign(null, user, id);

            user.Id.ShouldBe(id);
        }
        public void can_set_a_private_id()
        {
            var member = ReflectionHelper.GetProperty <UserWithPrivateId>(x => x.Id);
            var setter = LambdaBuilder.Setter <UserWithPrivateId, Guid>(member);

            var newGuid           = Guid.NewGuid();
            var userWithPrivateId = new UserWithPrivateId();

            setter(userWithPrivateId, newGuid);

            userWithPrivateId.Id.ShouldBe(newGuid);
        }
Example #3
0
        public void can_set_a_private_id()
        {
            var member = ReflectionHelper.GetProperty<UserWithPrivateId>(x => x.Id);
            var setter = LambdaBuilder.Setter<UserWithPrivateId, Guid>(member);

            var newGuid = Guid.NewGuid();
            var userWithPrivateId = new UserWithPrivateId();

            setter(userWithPrivateId, newGuid);

            userWithPrivateId.Id.ShouldBe(newGuid);
        }
Example #4
0
        public void when_id_setter_is_private()
        {
            var user = new UserWithPrivateId();

            theSession.Store(user);
            theSession.SaveChanges();

            user.Id.ShouldNotBe(Guid.Empty);

            var issue = theSession.Load <Issue>(user.Id);

            issue.ShouldBeNull();
        }