public void AssignsBareJId_FromIdentityToReview_WhenItExists() { LegalIdentity legalIdentity = new LegalIdentity { Properties = new[] { new Property(Constants.XmppProperties.JId, "42") } }; LegalIdentity identityToReview = new LegalIdentity { Properties = new[] { new Property(Constants.XmppProperties.JId, "43") } }; XmppClient client = new XmppClient("host", 4000, "user", "pass", string.Empty, GetType().Assembly); XmlDocument doc = new XmlDocument(); doc.LoadXml("<?xml version=\"1.0\" ?><root></root>"); ViewIdentityNavigationArgs args = new ViewIdentityNavigationArgs(legalIdentity, new SignaturePetitionEventArgs(new MessageEventArgs(client, doc.DocumentElement), identityToReview, Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "purpose", new byte[0])); this.navigationService.Setup(x => x.TryPopArgs(out args)).Returns(true); Given(AViewModel) .And(async vm => await vm.Bind()) .ThenAssert(vm => vm.BareJId == "43"); }
public void AssignsBareJId_FromLegalIdentity_WhenIdentityToReviewIsNull() { LegalIdentity legalIdentity = new LegalIdentity { Properties = new[] { new Property(Constants.XmppProperties.JId, "42") } }; ViewIdentityNavigationArgs args = new ViewIdentityNavigationArgs(legalIdentity, null); this.navigationService.Setup(x => x.TryPopArgs(out args)).Returns(true); Given(AViewModel) .And(async vm => await vm.Bind()) .ThenAssert(vm => vm.BareJId == "42"); }
public void AssignsLegalIdentity_FromTagProfile_WhenArgsIsEmpty() { LegalIdentity legalIdentity = new LegalIdentity { Properties = new[] { new Property(Constants.XmppProperties.JId, "42") } }; ViewIdentityNavigationArgs args = new ViewIdentityNavigationArgs(null, null); this.navigationService.Setup(x => x.TryPopArgs(out args)).Returns(true); this.tagProfile.SetupGet(x => x.LegalIdentity).Returns(legalIdentity); Given(AViewModel) .And(async vm => await vm.Bind()) .ThenAssert(vm => ReferenceEquals(legalIdentity, vm.LegalIdentity)); }