public void Generate_NewId_With64Chars_OnInstantiate() { var uid1 = new UniqueIdentifier(); var uid2 = new UniqueIdentifier(); Assert.NotNull(uid1); Assert.NotNull(uid2); Assert.NotEqual(uid1, uid2); Assert.NotEqual(uid1.ToString(), uid2.ToString()); Assert.Equal(64, uid1.ToString().Length); Assert.Equal(64, uid2.ToString().Length); }
public void Approve(UniqueIdentifier workflowInstance, UniqueIdentifier approvalRequest, bool approve, string reason = null) { if (workflowInstance == null) { throw new ArgumentNullException(nameof(workflowInstance)); } if (approvalRequest == null) { throw new ArgumentNullException(nameof(approvalRequest)); } ApprovalResponse response = new ApprovalResponse { Decision = approve ? ResourceFactoryClient.ApprovedText : ResourceFactoryClient.RejectedText, Reason = reason, Approval = approvalRequest.ToString() }; using (Message message = MessageComposer.CreateApprovalMessage(workflowInstance, response)) { using (Message responseMessage = this.Invoke((c) => c.Create(message))) { responseMessage.ThrowOnFault(); } } }
internal static Message CreateGetMessage(UniqueIdentifier id, IEnumerable <string> attributes, CultureInfo locale) { Get op = null; if (attributes != null && attributes.Any()) { op = new Get(); op.Dialect = Namespaces.RMIdentityAttributeType; op.Expressions = MessageComposer.AddMandatoryAttributes(attributes, locale).ToArray(); } Message message; if (op == null) { message = Message.CreateMessage(MessageVersion.Default, Namespaces.Get); } else { message = Message.CreateMessage(MessageVersion.Default, Namespaces.Get, new SerializerBodyWriter(op)); message.AddHeader(Namespaces.IdMDirectoryAccess, HeaderConstants.IdentityManagementOperation, null, true); } if (locale != null) { message.AddHeader(AttributeNames.Locale, locale); } message.AddHeader(HeaderConstants.ResourceReferenceProperty, id.ToString()); return(message); }
public void ConvertsImplicitly_To_String() { UniqueIdentifier uidNull = null; var uid = new UniqueIdentifier(); var uidString1 = (string)uid; var uidStringNull = (string)uidNull; string uidString2 = uid; string uidString3 = new UniqueIdentifier(); Assert.NotNull(uid); Assert.Null(uidStringNull); Assert.NotEmpty(uidString1); Assert.NotEmpty(uidString2); Assert.NotEmpty(uidString3); Assert.Equal(uid.ToString(), uidString1); Assert.Equal(uid.ToString(), uidString2); }
internal static Message CreateDeleteMessage(UniqueIdentifier id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } MessageComposer.ThrowOnDeleteBuiltInResource(id); Message message = Message.CreateMessage(MessageVersion.Default, Namespaces.Delete); message.AddHeader(HeaderConstants.ResourceReferenceProperty, id.ToString()); return(message); }
public void TestSVSetReferenceWithNullInitialValue() { UniqueIdentifier value1 = new UniqueIdentifier("0dcafc9f-d4cf-4754-b10d-4716d9a05be6"); UniqueIdentifier value2 = new UniqueIdentifier("9626643b-f4df-45a4-b080-df1d9a057bca"); List <object> testValues = new List <object>() { value1, value2 }; List <object> initialValues = new List <object>(); List <object> expectedValues = new List <object>() { value1.ToString(), value2.ToString() }; this.ExecuteMVTestSet(AttributeType.Reference, initialValues, testValues, expectedValues); }
public void TestSVRemoveReferenceWithInitialValue() { UniqueIdentifier value1 = new UniqueIdentifier("0dcafc9f-d4cf-4754-b10d-4716d9a05be6"); UniqueIdentifier value2 = new UniqueIdentifier("9626643b-f4df-45a4-b080-df1d9a057bca"); UniqueIdentifier value3 = new UniqueIdentifier("204a45d7-b6bd-4835-ae01-8245a9a710b2"); List <object> testValues = new List <object>() { value1, value2 }; List <object> initialValues = new List <object>() { value1, value2, value3 }; List <object> expectedValues = new List <object>() { value3.ToString() }; this.ExecuteMVTestRemove(AttributeType.Reference, initialValues, testValues, expectedValues); }
public void TestSVSetReferenceWithInitialValue() { UniqueIdentifier value1 = new UniqueIdentifier("0dcafc9f-d4cf-4754-b10d-4716d9a05be6"); UniqueIdentifier value2 = new UniqueIdentifier("9626643b-f4df-45a4-b080-df1d9a057bca"); UniqueIdentifier value3 = new UniqueIdentifier("204a45d7-b6bd-4835-ae01-8245a9a710b2"); UniqueIdentifier value4 = new UniqueIdentifier("1a9de914-ef41-4cf6-84ad-7515e704cbf5"); List <object> testValues = new List <object>() { value1, value2 }; List <object> initialValues = new List <object>() { value3, value4 }; List <object> expectedValues = new List <object>() { value1.ToString(), value2.ToString() }; this.ExecuteMVTestSet(AttributeType.Reference, initialValues, testValues, expectedValues); }
public void AllowsYouTo_ChooseThe_LengthOf_TheId() { var uid32 = new UniqueIdentifier(UniqueIdentifierLength.Length32); var uid40 = new UniqueIdentifier(UniqueIdentifierLength.Length40); var uid64 = new UniqueIdentifier(UniqueIdentifierLength.Length64); var uid96 = new UniqueIdentifier(UniqueIdentifierLength.Length96); var uid128 = new UniqueIdentifier(UniqueIdentifierLength.Length128); Assert.NotNull(uid32); Assert.Equal(32, uid32.ToString().Length); Assert.NotNull(uid40); Assert.Equal(40, uid40.ToString().Length); Assert.NotNull(uid64); Assert.Equal(64, uid64.ToString().Length); Assert.NotNull(uid96); Assert.Equal(96, uid96.ToString().Length); Assert.NotNull(uid128); Assert.Equal(128, uid128.ToString().Length); }
public void ConvertsImplicitly_From_String() { var uid1 = (UniqueIdentifier)"0000000000111111111100000000001111111111"; UniqueIdentifier uid2 = "0000000000111111111100000000001111111111"; var uidNull = (UniqueIdentifier)(string)null; string uidString1 = uid1; var uidString2 = (string)uid1; string uidString3 = new UniqueIdentifier(); Assert.NotNull(uid1); Assert.NotNull(uid2); Assert.Null(uidNull); Assert.NotEmpty(uidString1); Assert.NotEmpty(uidString2); Assert.NotEmpty(uidString3); Assert.Equal(uid1.ToString(), uidString1); Assert.Equal(uid1.ToString(), uidString2); Assert.Equal("0000000000111111111100000000001111111111", uid1.ToString()); Assert.Equal("0000000000111111111100000000001111111111", uid2.ToString()); Assert.Equal("0000000000111111111100000000001111111111", uidString1); Assert.Equal("0000000000111111111100000000001111111111", uidString2); }
protected override Task InitializeAsync() { log.Info($"Initialize async ({UniqueIdentifier.ToString()})"); return(base.InitializeAsync()); }
public AnotherViewModel() { log.Info($"Constructor ({UniqueIdentifier.ToString()})"); }
private static void ThrowOnDeleteBuiltInResource(UniqueIdentifier id) { if (id == MessageComposer.anonymousResource || id == MessageComposer.builtInAdminAccount || id == MessageComposer.fimServiceAccount || id == MessageComposer.syncServiceAccount) { throw new InvalidOperationException(string.Format("A request to delete a built-in resource has been stopped by the client library. Resource: {0}", id.ToString())); } }
public override string ToString() { return(string.IsNullOrWhiteSpace(Name) ? UniqueIdentifier.ToString() : Name); }