private void AssignProperties() { if (!(identity is null)) { this.Created = identity.Created; this.Updated = identity.Updated.GetDateOrNullIfMinValue(); this.LegalId = identity.Id; this.State = identity.State.ToString(); this.From = identity.From.GetDateOrNullIfMinValue(); this.To = identity.To.GetDateOrNullIfMinValue(); this.FirstName = identity[Constants.XmppProperties.FirstName]; this.MiddleNames = identity[Constants.XmppProperties.MiddleName]; this.LastNames = identity[Constants.XmppProperties.LastName]; this.PersonalNumber = identity[Constants.XmppProperties.PersonalNumber]; this.Address = identity[Constants.XmppProperties.Address]; this.Address2 = identity[Constants.XmppProperties.Address2]; this.ZipCode = identity[Constants.XmppProperties.ZipCode]; this.Area = identity[Constants.XmppProperties.Area]; this.City = identity[Constants.XmppProperties.City]; this.Region = identity[Constants.XmppProperties.Region]; this.CountryCode = identity[Constants.XmppProperties.Country]; this.Country = ISO_3166_1.ToName(this.CountryCode); this.IsApproved = identity.State == IdentityState.Approved; this.BareJId = identity.GetJId(Constants.NotAvailableValue); }
public void GetJid_ReturnsDefaultValue_IfPropertiesAreMissing() { LegalIdentity identity = new LegalIdentity { Id = Guid.NewGuid().ToString(), State = IdentityState.Approved }; Assert.AreEqual(DefaultValue, identity.GetJId(DefaultValue)); }
public void GetJid() { LegalIdentity identity = new LegalIdentity { Id = Guid.NewGuid().ToString(), State = IdentityState.Approved, Properties = new [] { new Property(Constants.XmppProperties.JId, "42") } }; Assert.AreEqual("42", identity.GetJId(DefaultValue)); }
public void GetJid_ReturnsDefaultValue_IfNotFound() { LegalIdentity identity = new LegalIdentity { Id = Guid.NewGuid().ToString(), State = IdentityState.Approved, Properties = new [] { new Property("Foo", "Bar") } }; Assert.AreEqual(DefaultValue, identity.GetJId(DefaultValue)); }