Exemplo n.º 1
0
        private IdentifierAccess CreateIdentifier(string text)
        {
            if (_identifiers.Contains(text))
            {
                return(_identifiers[text]);
            }
            else
            {
                var identifier = new IdentifierAccess(text);

                _identifiers.Add(identifier);

                return(identifier);
            }
        }
Exemplo n.º 2
0
        public void TestGetUser()
        {
            var baseLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            SampleConnector connector = new SampleConnector();

            connector.Initialize(baseLocation, null);

            var identifiers = new IdentifierCollection();

            identifiers.Add(new UpnIdentifier("*****@*****.**"));

            var attributes = new List <IAttribute>();

            var profile = connector.GetUser(identifiers, attributes);

            Assert.IsTrue(profile.Properties.Any(), "Failed to get attributes");
            Assert.IsTrue(profile.Identifiers.Identifiers.Any(), "Failed to get identifiers");
        }
Exemplo n.º 3
0
        public void TestUpdate()
        {
            var baseLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            SampleConnector connector = new SampleConnector();

            connector.Initialize(baseLocation, null);

            var identifiers = new IdentifierCollection();

            identifiers.Add(new UpnIdentifier("*****@*****.**"));

            var emergencyContactValue = "You need a " + Guid.NewGuid().ToString("D") + " emergency contact";

            // set the value
            connector.UpdateAttribute(identifiers, new SampleAttribute("emergencycontact"), emergencyContactValue);

            var attributes = new List <IAttribute>();
            var profile    = connector.GetUser(identifiers, attributes);

            Assert.IsTrue(profile.Properties["emergencycontact"].ToString() == emergencyContactValue, "Expected attibute value to be the new one. It wasn't.");
        }