/// <summary>
 /// Build a SystemResourceRetentionConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public SystemResourceRetentionConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "SystemResourceRetentionConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Build a ConstantSpecifier object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public ConstantSpecifier(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "ConstantSpecifier";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a msidmRequestTargetDetail object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public msidmRequestTargetDetail(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "msidmRequestTargetDetail";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Build a msidmCompositeType object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public msidmCompositeType(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "msidmCompositeType";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a ObjectVisualizationConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public ObjectVisualizationConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "ObjectVisualizationConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Build a FilterScope object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public FilterScope(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "FilterScope";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Build a Approval object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public Approval(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "Approval";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Build a mv_data object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public mv_data(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "mv-data";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Build a msidmRequestContext object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public msidmRequestContext(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "msidmRequestContext";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Build a DetectedRuleEntry object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public DetectedRuleEntry(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "DetectedRuleEntry";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Build a Set object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public Set(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "Set";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Build a WorkflowInstance object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public WorkflowInstance(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "WorkflowInstance";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a NavigationBarConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public NavigationBarConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "NavigationBarConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Build a GateRegistration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public GateRegistration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "GateRegistration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Build a SynchronizationRule object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public SynchronizationRule(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "SynchronizationRule";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Build a Function object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public Function(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "Function";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a ActivityInformationConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public ActivityInformationConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "ActivityInformationConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Build a BindingDescription object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public BindingDescription(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "BindingDescription";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a SupportedLocaleConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public SupportedLocaleConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "SupportedLocaleConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
 /// <summary>
 /// Build a msidmDataWarehouseBinding object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public msidmDataWarehouseBinding(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "msidmDataWarehouseBinding";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Build a EmailTemplate object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public EmailTemplate(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "EmailTemplate";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Build a WorkflowDefinition object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public WorkflowDefinition(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "WorkflowDefinition";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Build a HomepageConfiguration object from a IdmResource object
 /// </summary>
 /// <param name="resource">base class</param>
 public HomepageConfiguration(IdmResource resource)
 {
     Attributes = resource.Attributes;
     ObjectType = ForcedObjType = "HomepageConfiguration";
     if (resource.Creator == null)
         return;
     Creator = resource.Creator;
 }
        public void It_can_get_and_set_msidmAttributeTypeID()
        {
            // Act
            var testIdmResource = new IdmResource { DisplayName = "Test IdmResource" };
            _it.msidmAttributeTypeID = testIdmResource;

            // Assert
            Assert.AreEqual(testIdmResource.DisplayName, _it.msidmAttributeTypeID.DisplayName);
        }
Ejemplo n.º 25
0
        public void It_can_get_and_set_Target()
        {
            // Act
            var testIdmResource = new IdmResource { DisplayName = "Test IdmResource" };
            _it.Target = testIdmResource;

            // Assert
            Assert.AreEqual(testIdmResource.DisplayName, _it.Target.DisplayName);
        }
Ejemplo n.º 26
0
        public void It_can_get_and_set_Requestor()
        {
            // Act
            var testIdmResource = new IdmResource { DisplayName = "Test IdmResource" };
            _it.Requestor = testIdmResource;

            // Assert
            Assert.AreEqual(testIdmResource.DisplayName, _it.Requestor.DisplayName);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new msidmRequestContext(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new SystemResourceRetentionConfiguration(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new SynchronizationFilter(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new ObjectTypeDescription(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
                Creator     = new Person {
                    DisplayName = "Creator Display Name", ObjectID = "Creator ObjectID"
                },
            };
            var it = new NavigationBarConfiguration(resource);

            Assert.AreEqual("NavigationBarConfiguration", it.ObjectType);
            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.AreEqual("Creator Display Name", it.Creator.DisplayName);
        }
Ejemplo n.º 32
0
        public void It_has_a_constructor_that_takes_an_IdmResource()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
                Creator     = new Person {
                    DisplayName = "Creator Display Name", ObjectID = "Creator ObjectID"
                },
            };
            var it = new FilterScope(resource);

            Assert.AreEqual("FilterScope", it.ObjectType);
            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.AreEqual("Creator Display Name", it.Creator.DisplayName);
        }
Ejemplo n.º 33
0
        public void It_has_Requestor_which_can_be_set_back_to_null()
        {
            // Arrange
            var testIdmResource = new IdmResource {
                DisplayName = "Test IdmResource"
            };

            _it.Requestor = testIdmResource;

            // Act
            _it.Requestor = null;

            // Assert
            Assert.IsNull(_it.Requestor);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
                Creator     = new Person {
                    DisplayName = "Creator Display Name", ObjectID = "Creator ObjectID"
                },
            };
            var it = new msidmDataWarehouseBinding(resource);

            Assert.AreEqual("msidmDataWarehouseBinding", it.ObjectType);
            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.AreEqual("Creator Display Name", it.Creator.DisplayName);
        }
Ejemplo n.º 35
0
        It_can_GetMultiValuedAttrAsComplexObjects_when_the_attribute_has_values_and_matches_backing_field()
        {
            var subObjectID1 = Guid.NewGuid().ToString("D");
            var subObjectID2 = Guid.NewGuid().ToString("D");

            var resources = new List <IdmResource>
            {
                new IdmResource
                {
                    CreatedTime    = DateTime.Now,
                    Description    = "Test resource",
                    DisplayName    = "sub resource 1",
                    ExpirationTime = DateTime.Now + TimeSpan.FromDays(1),
                    MVObjectID     = Guid.NewGuid().ToString("D"),
                    ObjectID       = subObjectID1,
                    ObjectType     = "Resource",
                    ResourceTime   = DateTime.Now
                },
                new IdmResource
                {
                    CreatedTime    = DateTime.Now,
                    Description    = "Test resource",
                    DisplayName    = "sub resource 2",
                    ExpirationTime = DateTime.Now + TimeSpan.FromDays(1),
                    MVObjectID     = Guid.NewGuid().ToString("D"),
                    ObjectID       = subObjectID2,
                    ObjectType     = "Resource",
                    ResourceTime   = DateTime.Now
                }
            };

            var it = new IdmResource
            {
                Attributes =
                    new List <IdmAttribute> {
                    new IdmAttribute {
                        Name = "MultiValuedReferenceIDs", Values = new List <string> {
                            subObjectID1, subObjectID2
                        }
                    }
                }
            };

            var result = it.GetMultiValuedAttr("MultiValuedReferenceIDs", resources);

            Assert.AreEqual("sub resource 1", result[0].DisplayName);
            Assert.AreEqual("sub resource 2", result[1].DisplayName);
        }
Ejemplo n.º 36
0
        public void It_should_be_able_to_set_DateTime_based_single_value_properties()
        {
            var now      = DateTime.Now;
            var testTime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
            var it       = new IdmResource();

            it.CreatedTime    = testTime;
            it.DeletedTime    = testTime;
            it.ExpirationTime = testTime;
            it.ResourceTime   = testTime;

            Assert.AreEqual(testTime, it.CreatedTime);
            Assert.AreEqual(testTime, it.DeletedTime);
            Assert.AreEqual(testTime, it.ExpirationTime);
            Assert.AreEqual(testTime, it.ResourceTime);
        }
Ejemplo n.º 37
0
        public async Task T006_It_can_get_any_or_all_attributes_for_a_resource_by_its_ObjectID()
        {
            // Arrange
            var it = IdmNetClientFactory.BuildClient();

            // Act
            IdmResource result = await it.GetAsync("c51c9ef3-2de0-4d4e-b30b-c1a18e79c56e", new List <string> {
                "*"
            });

            // Assert
            Assert.AreEqual(6, result.Attributes.Count);
            Assert.AreEqual("c51c9ef3-2de0-4d4e-b30b-c1a18e79c56e", result.ObjectID);
            Assert.AreEqual("ObjectTypeDescription", result.ObjectType);
            Assert.AreEqual("Approval", result.DisplayName);
        }
Ejemplo n.º 38
0
        public void It_doesnt_end_up_with_superflous_attributes_by_calling_SetAttrValue()
        {
            // Arrange
            var it = new IdmResource {
                Description = "foo"
            };
            var attrCountBefore = it.Attributes.Count;

            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");

            var attrCountAfter = it.Attributes.Count;

            Assert.AreEqual(attrCountBefore, attrCountAfter);
        }
Ejemplo n.º 39
0
        private static IdmResource ConvertGetResponseToIdmResource(Message getResponseMsg)
        {
            BaseObjectSearchResponse getResponseObj =
                getResponseMsg.GetBody <BaseObjectSearchResponse>(new SoapXmlSerializer(typeof(BaseObjectSearchResponse)));

            var resource = new IdmResource();

            foreach (XmlNode partialAttribute in getResponseObj.PartialAttribute)
            {
                foreach (XmlNode attribute in partialAttribute.ChildNodes)
                {
                    BuildAttribute(attribute, resource);
                }
            }
            return(resource);
        }
Ejemplo n.º 40
0
        public async Task It_can_make_a_bunch_of_changes_at_the_same_time_for_a_single_resource()
        {
            // Arrange
            var         it           = IdmNetClientFactory.BuildClient();
            IdmResource testResource = await CreateTestPerson(it);

            var changes1 = new[]
            {
                new Change(ModeType.Replace, "FirstName", "FirstNameTest"),
                new Change(ModeType.Replace, "LastName", "LastNameTest"),
                new Change(ModeType.Add, "ProxyAddressCollection", "*****@*****.**"),
                new Change(ModeType.Add, "ProxyAddressCollection", "*****@*****.**"),
            };

            try
            {
                // Act
                Message result = await it.ChangeMultipleAttrbutes(testResource.ObjectID, changes1);

                // Assert
                Assert.IsFalse(result.IsFault);
                var searchResult =
                    await
                    it.SearchAsync(new SearchCriteria
                {
                    Filter =
                        new Filter
                    {
                        Query = "/Person[ObjectID='" + testResource.ObjectID + "']"
                    },
                    Selection = new List <string> {
                        "FirstName", "LastName", "ProxyAddressCollection"
                    }
                });

                var modifiedResource1 = searchResult.First();
                Assert.AreEqual("FirstNameTest", modifiedResource1.GetAttrValue("FirstName"));
                Assert.AreEqual("LastNameTest", modifiedResource1.GetAttrValue("LastName"));
                Assert.IsTrue(modifiedResource1.GetAttrValues("ProxyAddressCollection").Contains("*****@*****.**"));
                Assert.IsTrue(modifiedResource1.GetAttrValues("ProxyAddressCollection").Contains("*****@*****.**"));
            }
            finally
            {
                // Afterwards
                it.DeleteAsync(testResource.ObjectID);
            }
        }
Ejemplo n.º 41
0
        public async Task It_throws_an_exception_when_GetAsync_is_called_but_no_match_for_the_object_ID()
        {
            // Arrange
            var it = IdmNetClientFactory.BuildClient();

            // Act
            try
            {
                IdmResource result = await it.GetAsync("c51c9ef3-f00d-4d4e-b30b-c1a18e79c56e", null);

                Assert.IsTrue(false, "Should have encountered a KeyNotFoundException");
            }
            catch (KeyNotFoundException)
            {
                // Expected Exception
            }
        }
Ejemplo n.º 42
0
        public async Task It_doesnt_add_superflous_attributes_on_create()
        {
            // Arrange
            var         it           = IdmNetClientFactory.BuildClient();
            IdmResource createResult = null;

            try
            {
                var newUser = new IdmResource
                {
                    Attributes = new List <IdmAttribute>
                    {
                        new IdmAttribute {
                            Name = "ObjectType", Values = new List <string> {
                                "Person"
                            }
                        },
                        new IdmAttribute {
                            Name = "ObjectID", Values = new List <string> {
                            }
                        },
                        new IdmAttribute {
                            Name = "DisplayName", Values = new List <string> {
                                "_Test User"
                            }
                        },
                    }
                };
                createResult = await it.PostAsync(newUser);

                // assert
                Assert.AreEqual(3, createResult.Attributes.Count);
                Assert.AreEqual(newUser.DisplayName, createResult.DisplayName);
                var result = await it.GetAsync(createResult.ObjectID, new List <string> {
                    "DisplayName"
                });

                Assert.AreEqual(newUser.DisplayName, result.DisplayName);
            }
            finally
            {
                // afterwards
                it.DeleteAsync(createResult.ObjectID);
            }
            // Act
        }
Ejemplo n.º 43
0
        public void It_should_return_null_for_empty_properties()
        {
            var it = new IdmResource();

            Assert.IsNull(it.ObjectID);
            Assert.IsNull(it.ObjectType);
            Assert.IsNull(it.CreatedTime);
            Assert.IsNull(it.Creator);
            Assert.IsNull(it.DeletedTime);
            Assert.IsNull(it.Description);
            Assert.IsNull(it.DisplayName);
            Assert.IsNull(it.ExpirationTime);
            Assert.IsNull(it.MVObjectID);
            Assert.IsNull(it.ResourceTime);
            Assert.IsNull(it.DetectedRulesList);
            Assert.IsNull(it.ExpectedRulesList);
            Assert.IsNull(it.Locale);
        }
Ejemplo n.º 44
0
        It_can_GetAttributeAsComplexObject_when_the_attribute_has_a_refId_value_and_the_backing_field_is_null()
        {
            var         creatorObjectID = Guid.NewGuid().ToString("D");
            IdmResource subResource     = null;

            var it = new IdmResource {
                Attributes = new List <IdmAttribute> {
                    new IdmAttribute {
                        Name = "Creator", Value = creatorObjectID
                    }
                }
            };

            // ReSharper disable once ExpressionIsAlwaysNull
            it.GetAttr("Creator", subResource);

            Assert.AreEqual(creatorObjectID, it.Creator.ObjectID);
        }
Ejemplo n.º 45
0
        public void It_can_SettAttrValue_nullable_null_value_and_come_back_as_null_as_either_Value_or_ToInt()
        {
            var it = new IdmResource();

            it.SetAttrValue("foo", null);

            var result1 = it.GetAttrValue("foo");
            var result2 = it.GetAttr("foo").ToInteger();
            var result3 = it.GetAttr("foo").ToDateTime();
            var result4 = it.GetAttr("foo").ToBinary();
            var result5 = it.GetAttr("foo").ToBool();

            Assert.IsNull(result1);
            Assert.IsNull(result2);
            Assert.IsNull(result3);
            Assert.IsNull(result4);
            Assert.IsNull(result5);
        }
Ejemplo n.º 46
0
        public void It_can_GetAttrValues_after_they_have_been_created()
        {
            var it = new IdmResource
            {
                Attributes =
                    new List <IdmAttribute> {
                    new IdmAttribute {
                        Name = "foo", Values = new List <string> {
                            "foo", "bar"
                        }
                    }
                }
            };

            var result = it.GetAttrValues("foo");

            Assert.AreEqual("foo", result[0]);
            Assert.AreEqual("bar", result[1]);
        }
Ejemplo n.º 47
0
        public async Task It_can_delete_a_value_from_a_multi_valued_attribute()
        {
            // Arrange
            const string attrName     = "ProxyAddressCollection";
            const string attrValue1   = "*****@*****.**";
            const string attrValue2   = "*****@*****.**";
            var          it           = IdmNetClientFactory.BuildClient();
            IdmResource  testResource = await CreateTestPerson(it);

            try
            {
                await it.AddValueAsync(testResource.ObjectID, attrName, attrValue1);

                await it.AddValueAsync(testResource.ObjectID, attrName, attrValue2);

                // Act
                Message result = await it.RemoveValueAsync(testResource.ObjectID, attrName, attrValue2);

                // Assert
                Assert.IsFalse(result.IsFault);
                var searchResult =
                    await
                    it.SearchAsync(new SearchCriteria
                {
                    Filter =
                        new Filter
                    {
                        Query = "/Person[ObjectID='" + testResource.ObjectID + "']"
                    },
                    Selection = new List <string> {
                        "ProxyAddressCollection"
                    }
                });

                Assert.IsFalse(searchResult.First().GetAttrValues(attrName).Contains(attrValue2));
            }
            finally
            {
                // Afterwards
                it.DeleteAsync(testResource.ObjectID);
            }
        }
Ejemplo n.º 48
0
        public void It_can_set_and_get_Creator()
        {
            var creator = new Person
            {
                CreatedTime    = DateTime.Now,
                Description    = "Test creator",
                DisplayName    = "Joe User",
                ExpirationTime = DateTime.Now + TimeSpan.FromDays(1),
                MVObjectID     = Guid.NewGuid().ToString("D"),
                ObjectID       = Guid.NewGuid().ToString("D"),
                ObjectType     = "Person",
                ResourceTime   = DateTime.Now
            };

            var it = new IdmResource();

            it.Creator = creator;

            Assert.AreEqual("Test creator", it.Creator.Description);
        }
Ejemplo n.º 49
0
        public async Task It_throws_an_exception_when_you_treat_a_single_valued_attribute_as_if_it_is_multi_valued()
        {
            // Arrange
            const string attrName     = "FirstName";
            const string attrValue    = "Testing";
            var          it           = IdmNetClientFactory.BuildClient();
            IdmResource  testResource = await CreateTestPerson(it);

            // Act
            try
            {
                Message result = await it.AddValueAsync(testResource.ObjectID, attrName, attrValue);

                Assert.IsFalse(result.IsFault);
            }
            finally
            {
                // Afterwards
                it.DeleteAsync(testResource.ObjectID);
            }
        }
Ejemplo n.º 50
0
        It_can_set_complex_properties_to_null()
        {
            // Arrange
            var it = new IdmResource
            {
                Creator = new Person {
                    DisplayName = "foo"
                },
                DetectedRulesList =
                    new List <IdmResource>
                {
                    new IdmResource {
                        DisplayName = "bar", ObjectID = "bar"
                    },
                    new IdmResource {
                        DisplayName = "bat", ObjectID = "bat"
                    }
                },
                ExpectedRulesList =
                    new List <IdmResource>
                {
                    new IdmResource {
                        DisplayName = "fiz", ObjectID = "fiz"
                    },
                    new IdmResource {
                        DisplayName = "buz", ObjectID = "buz"
                    }
                },
            };

            // Act
            it.Creator           = null;
            it.DetectedRulesList = null;
            it.ExpectedRulesList = null;

            // Assert
            Assert.IsNull(it.Creator);
            Assert.IsNull(it.DetectedRulesList);
            Assert.IsNull(it.ExpectedRulesList);
        }
Ejemplo n.º 51
0
        public void It_can_retrieve_attributes_with_an_indexer()
        {
            var it = new IdmResource
            {
                Attributes =
                    new List <IdmAttribute>
                {
                    new IdmAttribute {
                        Name = "foo1", Values = new List <string> {
                            "foo1", "bar1"
                        }
                    },
                    new IdmAttribute {
                        Name = "foo2", Values = new List <string> {
                            "foo2", "bar2"
                        }
                    },
                    new IdmAttribute {
                        Name = "foo3", Values = new List <string> {
                            "foo3", "bar3"
                        }
                    },
                    new IdmAttribute {
                        Name = "foo4", Values = new List <string> {
                            "foo4", "bar4"
                        }
                    },
                    new IdmAttribute {
                        Name = "foo5", Values = new List <string> {
                            "foo5", "bar5"
                        }
                    }
                }
            };

            var result = it["foo1"];

            Assert.AreEqual("foo1", result.Values[0]);
            Assert.AreEqual("bar1", result.Values[1]);
        }
Ejemplo n.º 52
0
        It_can_SetMultiValuedAttrAsComplexObjects_when_only_some_of_the_items_are_in_the_backing_field()
        {
            var subObjectID1 = Guid.NewGuid().ToString("D");
            var subObjectID2 = Guid.NewGuid().ToString("D");

            List <IdmResource> backingField;
            var resources = new List <IdmResource>
            {
                new IdmResource
                {
                    CreatedTime    = DateTime.Now,
                    Description    = "Test resource",
                    DisplayName    = "sub resource 1",
                    ExpirationTime = DateTime.Now + TimeSpan.FromDays(1),
                    MVObjectID     = Guid.NewGuid().ToString("D"),
                    ObjectID       = subObjectID1,
                    ObjectType     = "Resource",
                    ResourceTime   = DateTime.Now
                },
                new IdmResource
                {
                    CreatedTime    = DateTime.Now,
                    Description    = "Test resource",
                    DisplayName    = "sub resource 2",
                    ExpirationTime = DateTime.Now + TimeSpan.FromDays(1),
                    MVObjectID     = Guid.NewGuid().ToString("D"),
                    ObjectID       = subObjectID2,
                    ObjectType     = "Resource",
                    ResourceTime   = DateTime.Now
                }
            };

            var it = new IdmResource();

            it.SetMultiValuedAttr("MultiValuedReferenceIDs", out backingField, resources);

            Assert.AreEqual("sub resource 1", backingField[0].DisplayName);
            Assert.AreEqual("sub resource 2", backingField[1].DisplayName);
        }
Ejemplo n.º 53
0
        private static void BuildAttribute(XmlNode attribute, IdmResource resource)
        {
            string name = attribute.LocalName;
            string val  = attribute.InnerText;

            if (val.StartsWith("urn:uuid:"))
            {
                val = val.Substring(9);
            }

            var attr = resource.GetAttr(name);

            if (attr != null)
            {
                attr.Values.Add(val);
            }
            else
            {
                resource.Attributes.Add(new IdmAttribute {
                    Name = name, Value = val
                });
            }
        }
Ejemplo n.º 54
0
        public async Task T008_It_can_create_objects_in_Identity_Manager()
        {
            // Arrange
            var it = IdmNetClientFactory.BuildClient();

            // Act
            var newUser = new IdmResource {
                ObjectType = "Person", DisplayName = "Test User"
            };
            IdmResource createResult = await it.PostAsync(newUser);

            Assert.AreEqual(newUser.DisplayName, createResult.DisplayName);

            // assert
            var result = await it.GetAsync(createResult.ObjectID, new List <string> {
                "DisplayName"
            });

            Assert.AreEqual(newUser.DisplayName, result.DisplayName);

            // afterwards
            await it.DeleteAsync(createResult.ObjectID);
        }
Ejemplo n.º 55
0
        public void It_can_SetAttrValues_on_an_attribute_that_already_has_values()
        {
            var it = new IdmResource
            {
                Attributes =
                    new List <IdmAttribute> {
                    new IdmAttribute {
                        Name = "foo", Values = new List <string> {
                            "foo", "bar"
                        }
                    }
                }
            };

            it.SetAttrValues("foo", new List <string> {
                "fiz", "buz"
            });

            var result = it.GetAttrValues("foo");

            Assert.AreEqual("fiz", result[0]);
            Assert.AreEqual("buz", result[1]);
        }
Ejemplo n.º 56
0
        public async Task It_can_add_a_value_to_a_multi_valued_attribute_that_already_has_one_or_more_values
            ()
        {
            // Arrange
            const string attrName     = "SearchScopeContext";
            const string attrValue    = "FirstName";
            var          it           = IdmNetClientFactory.BuildClient();
            IdmResource  testResource = await CreateTestSearchScope(it);

            // Act
            try
            {
                await it.AddValueAsync(testResource.ObjectID, attrName, attrValue);

                // Assert
                var searchResult =
                    await
                    it.SearchAsync(new SearchCriteria
                {
                    Filter =
                        new Filter
                    {
                        Query = "/SearchScopeConfiguration[ObjectID='" + testResource.ObjectID + "']"
                    },
                    Selection = new List <string> {
                        "SearchScopeContext"
                    }
                });

                Assert.IsTrue(searchResult.First().GetAttrValues(attrName).Contains(attrValue));
            }
            finally
            {
                // Afterwards
                it.DeleteAsync(testResource.ObjectID);
            }
        }
Ejemplo n.º 57
0
        public async Task It_can_modify_single_valued_attribute_that_was_previously_null()
        {
            // Arrange
            const string attrName     = "FirstName";
            const string attrValue    = "TestFirstName";
            var          it           = IdmNetClientFactory.BuildClient();
            IdmResource  testResource = await CreateTestPerson(it);

            try
            {
                // Act
                Message result = await it.ReplaceValueAsync(testResource.ObjectID, attrName, attrValue);

                // Assert
                Assert.IsFalse(result.IsFault);
                var searchResult =
                    await
                    it.SearchAsync(new SearchCriteria
                {
                    Filter =
                        new Filter
                    {
                        Query = "/Person[ObjectID='" + testResource.ObjectID + "']"
                    },
                    Selection = new List <string> {
                        attrName
                    }
                });

                Assert.AreEqual(attrValue, searchResult.First().GetAttrValue(attrName));
            }
            finally
            {
                // Afterwards
                it.DeleteAsync(testResource.ObjectID);
            }
        }
Ejemplo n.º 58
0
        public void It_can_GettAttr_that_then_allows_modification_of_the_attr()
        {
            var it = new IdmResource
            {
                Attributes =
                    new List <IdmAttribute> {
                    new IdmAttribute {
                        Name = "foo", Values = new List <string> {
                            "foo", "bar"
                        }
                    }
                }
            };

            var attr = it.GetAttr("foo");

            attr.Values.Add("bat");

            var result = it.GetAttrValues("foo");

            Assert.AreEqual("foo", result[0]);
            Assert.AreEqual("bar", result[1]);
            Assert.AreEqual("bat", result[2]);
        }