Amss.Boilerplate.Tests.Persistence.SpecificationTests.PartnerUserSpecification C# (CSharp) Method

PartnerUserSpecification() private method

private PartnerUserSpecification ( ) : void
return void
        public void PartnerUserSpecification()
        {
            var role = new PersistenceSpecification<RoleEntity>(this.Session)
                .CheckProperty(c => c.Name, this.ShortStringGenerator.GetRandomValue())
            .VerifyTheMappings();

            var user = new PersistenceSpecification<UserEntity>(this.Session)
                .CheckProperty(c => c.Name, this.ShortStringGenerator.GetRandomValue())
                .CheckProperty(c => c.Email, this.ShortStringGenerator.GetRandomValue())
                .CheckEntity(c => c.Role, role)
            .VerifyTheMappings();

            var partner = new PersistenceSpecification<PartnerEntity>(this.Session)
                .CheckProperty(c => c.Name, this.ShortStringGenerator.GetRandomValue())
            .VerifyTheMappings();

            partner.Users.Add(user);

            this.Session.Flush();
            this.Session.Clear();

            user = this.Session.Load<UserEntity>(user.Id);

            Assert.That(user.Partner, Is.Not.Null);
        }