public sealed override void Specify()
        {
            when("using RavenMembershipProvider in-memory", delegate
            {
                var provider = new OverrideForInMemoryRavenMembershipProvider();

                arrange_membership_provider(provider);

                SpecifyForEach(false);
            });

            when("using SQLMembershipProvider", delegate
            {
                var provider = new OverrideForSqlMembershipProvider();

                arrange_membership_provider(provider);

                SpecifyForEach(true);
            });

            when("using raven with munin on disk", delegate
            {
                var provider = new OverrideForMuninRavenMembershipProvider();

                arrange_membership_provider(provider);

                SpecifyForEach(false);
            });

            when("using raven with esent on disk", delegate
            {
                var provider = new OverrideForEsentRavenMembershipProvider();

                arrange_membership_provider(provider);

                SpecifyForEach(false);
            });
        }
示例#2
0
        public override void Specify()
        {
            when("using SqlMembershipProvider", delegate
            {
                var membershipOverride = new OverrideForSqlMembershipProvider();

                arrange_membership_provider(membershipOverride);

                then_membership_provider_should_be <SqlMembershipProvider>();

                then("the connection string is set", delegate
                {
                    var connectionStringField = typeof(SqlMembershipProvider).GetField("_sqlConnectionString", BindingFlags.NonPublic | BindingFlags.Instance);

                    Assert.That(connectionStringField, Is.Not.Null);

                    string connectionStringValue = (string)connectionStringField.GetValue(Membership.Provider);

                    expect(() => connectionStringValue == DatabaseInitialization.GetConnectionStringFor(FixtureConstants.DatabaseName));
                });
            });

            when("using RavenDBMembershipProvider embedded in-memory", delegate
            {
                var membershipOverride = new OverrideForInMemoryRavenMembershipProvider();

                arrange_membership_provider(membershipOverride);

                then_membership_provider_should_be <RavenDBMembershipProvider>();

                then("RavenDB store is configured to run munin in memory", delegate
                {
                    Assert.That(GetMembershipDocumentStore(), Is.InstanceOf <EmbeddableDocumentStore>());

                    expect(() => GetMembershipDocumentConfiguration().RunInMemory);

                    expect(() => String.IsNullOrEmpty(GetMembershipDocumentConfiguration().DataDirectory) ||
                           !Directory.Exists(GetMembershipDocumentConfiguration().DataDirectory));
                });
            });

            when("using RavenDBMembershipProvider embedded w/ munin on disk", delegate
            {
                var membershipOverride = new OverrideForMuninRavenMembershipProvider();

                arrange_membership_provider(membershipOverride);

                then_membership_provider_should_be <RavenDBMembershipProvider>();

                then("RavenDB store is configured to use munin stored in disk", delegate
                {
                    Assert.That(GetMembershipDocumentStore(), Is.InstanceOf <EmbeddableDocumentStore>());

                    expect(() => !GetMembershipDocumentConfiguration().RunInMemory);
                    expect(() => !String.IsNullOrEmpty(GetMembershipDocumentConfiguration().DataDirectory));

                    expect_embedded_TransactionalStorage_FriendlyName_is("Munin");
                });
            });

            when("using RavenDBMembershipProvider embedded w/ esent on disk", delegate
            {
                var membershipOverride = new OverrideForEsentRavenMembershipProvider();

                arrange_membership_provider(membershipOverride);

                then_membership_provider_should_be <RavenDBMembershipProvider>();

                then("RavenDB store is configured to use esent", delegate()
                {
                    expect(() => !GetMembershipDocumentConfiguration().RunInMemory);
                    expect(() => !String.IsNullOrEmpty(GetMembershipDocumentConfiguration().DataDirectory));

                    expect_embedded_TransactionalStorage_FriendlyName_is("Esent");
                });
            });
        }