public void Should_Ignore_When_Invoke_inSecond_time_With_Outside_session() { _enableOutsideSession = true; using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); var status = ObtainUser("user"); status.Should().Be(MembershipCreateStatus.Success); _outsideSession.SubmitChanges(); ObtainUserInRole("user", "role3"); _outsideSession.SubmitChanges(); } using (var session = RavenDb.Storage.OpenSession()) { session.Query <RoleEntity>().Should().HaveCount(3); session.Query <RoleEntity>().Select(r => r.RoleName).Should().Contain("role1", "role2", "role3"); session.Query <UserEntity>().Should().HaveCount(1); session.Query <UserEntity>().Select(u => u.Username).Should().OnlyContain(u => u == "user"); session.Query <UserEntity>().Single().Roles.Should().OnlyContain(r => r == "role3"); } using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); var status = ObtainUser("user", "role3"); status.Should().BeNull(); } }
public void Should_Executed_Correctly_With_Outside_session() { _enableOutsideSession = true; using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); } using (_outsideSession = RavenDb.Storage.OpenSession()) { var status = ObtainUser("user", "role3"); _outsideSession.SubmitChanges(); status.Should().Be(MembershipCreateStatus.Success); } }
public void Should_Executed_Correctly_With_Outside_session() { _enableOutsideSession = true; using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); } using (_outsideSession = RavenDb.Storage.OpenSession()) { var status = ObtainUser("user", "role3"); _outsideSession.SubmitChanges(); status.Should().Be(MembershipCreateStatus.Success); } }
public void Should_Ignore_When_Invoke_inSecond_time_With_Outside_session() { _enableOutsideSession = true; using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); var status = ObtainUser("user"); status.Should().Be(MembershipCreateStatus.Success); _outsideSession.SubmitChanges(); ObtainUserInRole("user", "role3"); _outsideSession.SubmitChanges(); } using (var session = RavenDb.Storage.OpenSession()) { session.Query<RoleEntity>().Should().HaveCount(3); session.Query<RoleEntity>().Select(r => r.RoleName).Should().Contain("role1", "role2", "role3"); session.Query<UserEntity>().Should().HaveCount(1); session.Query<UserEntity>().Select(u => u.Username).Should().OnlyContain(u => u == "user"); session.Query<UserEntity>().Single().Roles.Should().OnlyContain(r => r == "role3"); } using (_outsideSession = RavenDb.Storage.OpenSession()) { ObtainRequiredRoles("role1", "role2", "role3"); _outsideSession.SubmitChanges(); var status = ObtainUser("user", "role3"); status.Should().BeNull(); } }