Ejemplo n.º 1
0
        public void override_the_label_and_field_layout_with_a_func()
        {
            var profile = new TagProfile("default");

            profile.UseLabelAndFieldLayout(() => new FakeLabelAndField());
            profile.NewLabelAndFieldLayout().ShouldBeOfType <FakeLabelAndField>();
        }
Ejemplo n.º 2
0
 public TagProfileExpression()
 {
     Profile = new TagProfile("default");
     Labels = new TagFactoryExpression(Profile.Label);
     Editors = new TagFactoryExpression(Profile.Editor);
     Displays = new TagFactoryExpression(Profile.Display);
 }
 public TagProfileExpression(TagProfile profile)
 {
     _profile = profile;
     Labels = new TagFactoryExpression(profile.Label);
     Editors = new TagFactoryExpression(profile.Editor);
     Displays = new TagFactoryExpression(profile.Display);
 }
Ejemplo n.º 4
0
 public TagProfileExpression()
 {
     Profile  = new TagProfile("default");
     Labels   = new TagFactoryExpression(Profile.Label);
     Editors  = new TagFactoryExpression(Profile.Editor);
     Displays = new TagFactoryExpression(Profile.Display);
 }
Ejemplo n.º 5
0
        public void SetDomain_ToAValidValue_IncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
        }
Ejemplo n.º 6
0
        public void SetAccount_ToAValidValue_WhenNotOnAccountStep_DoesNotIncrementStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
        }
Ejemplo n.º 7
0
        public void SetDomain_ToAnInvalidValue_DoesNotIncrementStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("");
            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
        }
Ejemplo n.º 8
0
        public void SetAccountAndLegalIdentity_ToAnInvalidValue1_DoesNotIncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccountAndLegalIdentity("account", "hash", "hashMethod", null);
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
        }
Ejemplo n.º 9
0
        public void ClearDomain_DecrementsStepToOperator()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.ClearDomain();
            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
        }
Ejemplo n.º 10
0
 public void Import(TagProfile peer)
 {
     Label.Merge(peer.Label);
     Display.Merge(peer.Display);
     Editor.Merge(peer.Editor);
     BeforePartial.Merge(peer.BeforePartial);
     AfterPartial.Merge(peer.AfterPartial);
     BeforeEachOfPartial.Merge(peer.BeforeEachOfPartial);
     AfterEachOfPartial.Merge(peer.AfterEachOfPartial);
 }
Ejemplo n.º 11
0
        public void SetAccount_ToAnInvalidValue_DoesNotIncrementStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
        }
Ejemplo n.º 12
0
        public void SetAccount_ToAValidValue_IncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
        }
Ejemplo n.º 13
0
        public void ClearLegalIdentity_DecrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            tagProfile.ClearLegalIdentity();
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
        }
Ejemplo n.º 14
0
        public void SetPin_IfNotOnPinStep_DoesNotIncrementStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            tagProfile.SetPin("pin", false);
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
        }
Ejemplo n.º 15
0
        public TagProfileExpression(TagProfile profile)
        {
            _profile = profile;
            Labels = new TagFactoryExpression(profile.Label);
            Editors = new TagFactoryExpression(profile.Editor);
            Displays = new TagFactoryExpression(profile.Display);

            BeforePartial = new TagFactoryExpression(profile.BeforePartial);
            AfterPartial = new TagFactoryExpression(profile.AfterPartial);
            BeforeEachOfPartial = new PartialTagFactoryExpression(profile.BeforeEachOfPartial);
            AfterEachOfPartial = new PartialTagFactoryExpression(profile.AfterEachOfPartial);
        }
Ejemplo n.º 16
0
        public void SetIsValidated_WhenNotValidated_DoesNotIncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            tagProfile.SetIsValidated();
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
        }
Ejemplo n.º 17
0
        public void SetAccountAndLegalIdentity_ToAValidValue_WhereIdentityIsApproved_IncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Approved
            };

            tagProfile.SetAccountAndLegalIdentity("account", "hash", "hashMethod", identity);
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
        }
Ejemplo n.º 18
0
        public void SetAccountAndLegalIdentity_ToAnInvalidValue2_DoesNotIncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Compromised
            };

            tagProfile.SetAccountAndLegalIdentity("", "hash", "hashMethod", identity);
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
        }
Ejemplo n.º 19
0
        public void ClearAccount_DecrementsStepToOperator()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            tagProfile.SetLegalJId("jid");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            tagProfile.ClearAccount();
            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            Assert.IsNull(tagProfile.LegalJid);
        }
Ejemplo n.º 20
0
        public void CompromiseLegalIdentity_DecrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            LegalIdentity identity = CreateIdentity(IdentityState.Created);

            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
            tagProfile.CompromiseLegalIdentity(CreateIdentity(IdentityState.Compromised));
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
        }
Ejemplo n.º 21
0
        public void SetLegalIdentity_ToAValidValue1_IncrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Created
            };

            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
        }
Ejemplo n.º 22
0
        public void ClearPin_WhenNotComplete_DecrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Approved
            };

            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
            tagProfile.SetIsValidated();
            Assert.AreEqual(RegistrationStep.Pin, tagProfile.Step);
            tagProfile.ClearPin();
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
        }
Ejemplo n.º 23
0
        public void ClearIsValidated_DecrementsStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            tagProfile.SetLegalJId("jid");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Approved
            };

            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.ValidateIdentity, tagProfile.Step);
            tagProfile.ClearIsValidated();
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            Assert.IsNull(tagProfile.LegalIdentity);
            Assert.AreEqual("jid", tagProfile.LegalJid);
        }
Ejemplo n.º 24
0
        public void SetLegalIdentity_ToAnInvalidValue_DoesNotIncrementStep()
        {
            TagProfile tagProfile = new TagProfile();

            Assert.AreEqual(RegistrationStep.Operator, tagProfile.Step);
            tagProfile.SetDomain("domain");
            Assert.AreEqual(RegistrationStep.Account, tagProfile.Step);
            tagProfile.SetAccount("account", "hash", "hashMethod");
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);

            LegalIdentity identity = new LegalIdentity {
                State = IdentityState.Compromised
            };

            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            identity.State = IdentityState.Obsoleted;
            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
            identity.State = IdentityState.Rejected;
            tagProfile.SetLegalIdentity(identity);
            Assert.AreEqual(RegistrationStep.RegisterIdentity, tagProfile.Step);
        }
Ejemplo n.º 25
0
        public void by_default_the_label_and_field_layout_is_definition_list()
        {
            var profile = new TagProfile("default");

            profile.NewLabelAndFieldLayout().ShouldBeOfType <DefinitionListLabelAndField>();
        }
Ejemplo n.º 26
0
 public void Import(TagProfile peer)
 {
     Label.Merge(peer.Label);
     Display.Merge(peer.Display);
     Editor.Merge(peer.Editor);
 }
Ejemplo n.º 27
0
 public void override_the_label_and_field_layout_with_a_func()
 {
     var profile = new TagProfile("default");
     profile.UseLabelAndFieldLayout(() => new FakeLabelAndField());
     profile.NewLabelAndFieldLayout().ShouldBeOfType<FakeLabelAndField>();
 }
 public void Import(TagProfile peer)
 {
     Label.Merge(peer.Label);
     Display.Merge(peer.Display);
     Editor.Merge(peer.Editor);
 }
Ejemplo n.º 29
0
 public void ImportProfile(TagProfile profile)
 {
     _profiles[profile.Name].Import(profile);
 }
Ejemplo n.º 30
0
 public void by_default_the_label_and_field_layout_is_definition_list()
 {
     var profile = new TagProfile("default");
     profile.NewLabelAndFieldLayout().ShouldBeOfType<DefinitionListLabelAndField>();
 }