public bool InteressentMandatoryFill()
        {
            try
            {
                Language.SendKeys(LanguagesEnglishVersion.English);
                Title.EnterText(Titles.Ms);
                FirstName.EnterText(string.Format("{0}", Name));
                LastName.EnterText(string.Format("{0}", Name));
                Email.EnterText(Emails.HrmTest);
                Telephone.EnterText("084-2565584");

                Nationality.Click();
                PropertiesCollection.Sleep500();
                page1NationalityGerman.Click();

                Submit.Click();

                while (!ReadyThankyou())
                {
                    ;
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool ApplicantMandatoryFill()
        {
            try
            {
                while (!ReadyPage())
                {
                    ;
                }

                Title.SendKeys(Titles.Prof);
                FirstName.EnterText(string.Format("{0}", Name));
                SureName.EnterText(string.Format("{0}", Name));
                Email.EnterText(Emails.HrmTest);
                PhoneNumber.EnterText("081-2564459");

                Nationality.Click();
                PropertiesCollection.Sleep500();
                NationalityGerman.Click();
                PropertiesCollection.Sleep100();

                ApplyNow.Click();
                while (!ReadyThankyou())
                {
                    ;
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public Identity Clone(bool includeMemberships)
        {
            PropertiesCollection properties = new PropertiesCollection(Properties, validateExisting: false);

            Identity clone = new Identity(properties)
            {
                Id                  = Id,
                Descriptor          = new IdentityDescriptor(Descriptor),
                ProviderDisplayName = ProviderDisplayName,
                CustomDisplayName   = CustomDisplayName,
                IsActive            = IsActive,
                UniqueUserId        = UniqueUserId,
                IsContainer         = IsContainer,
                ResourceVersion     = ResourceVersion,
                MetaTypeId          = MetaTypeId
            };

            if (includeMemberships)
            {
                clone.Members     = CloneDescriptors(Members);
                clone.MemberOf    = CloneDescriptors(MemberOf);
                clone.MemberIds   = MemberIds?.ToList();
                clone.MemberOfIds = MemberOfIds?.ToList();
            }

            clone.MasterId = MasterId;

            return(clone);
        }
        private PropertiesCollection GetProperties(string target, SvnRevision asOfRevision, bool recurse)
        {
            try
            {
                PropertiesCollection result = new PropertiesCollection();
                Collection <SvnPropertyListEventArgs> output;
                SvnPropertyListArgs args = new SvnPropertyListArgs();
                args.Revision = asOfRevision;
                args.Depth    = recurse ? SvnDepth.Infinity : SvnDepth.Children;

                client.GetPropertyList(new Uri(target), args, out output);

                foreach (SvnPropertyListEventArgs eventArgs in output)
                {
                    Dictionary <string, string> properties = new Dictionary <string, string>(eventArgs.Properties.Count);
                    foreach (SvnPropertyValue value in eventArgs.Properties)
                    {
                        properties.Add(value.Key, value.StringValue);
                    }
                    result.Add(eventArgs.Path, properties);
                }

                return(result);
            }
            catch (Exception ex)
            {
                OnError(ex);
            }

            return(null);
        }
        private decimal GetPropertiesScore(PropertiesCollection projectInfoProperties, IReadOnlyCollection <string> tokens)
        {
            List <string> listValues = new List <string>();

            foreach (Property projectInfoProperty in projectInfoProperties)
            {
                if (projectInfoProperty.ValueList != null && projectInfoProperty.ValueList.Any())
                {
                    listValues.AddRange(projectInfoProperty.ValueList);
                }
            }
            decimal listPropertiesScore = this.GetStringScore(listValues, ScoreMultipliers.ListProperties, tokens);


            List <string> singleValues = new List <string>();

            foreach (Property projectInfoProperty in projectInfoProperties)
            {
                if (projectInfoProperty.ValueList == null || !projectInfoProperty.ValueList.Any())
                {
                    singleValues.Add(projectInfoProperty.Value);
                }
            }
            decimal singlePropertiesScore = this.GetStringScore(singleValues, ScoreMultipliers.Properties, tokens);

            return(singlePropertiesScore + listPropertiesScore);
        }
Exemplo n.º 6
0
        public void TestUserStory10()
        {
            try
            {
                const String INPUT_FILE = "User.xml";
                const String COMMENT    = "HEheheh";
                const string SUBJECT    = "Covor Sierpinski";
                const string CATEGORY   = "Fractali Turtle";
                User         user       = XML.DeserializeObject <User>(FileUtils.CreateInputPath(INPUT_FILE));

                PropertiesCollection.OpenURL(Constants.START_URL);
                Panel.Log_Click();
                Authentication.Login(user);
                Panel.Galerie_Click();
                ForumClass.NavigateToCategory(CATEGORY);
                ForumClass.NavigateToSubject(SUBJECT);
                ForumClass.AddComment(COMMENT);
                ForumClass.DeleteComment(COMMENT);
            }
            catch (Exception e)
            {
                Logger.LogException("", e);
                Assert.Fail(e.Message);
            }
        }
        protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changedPathInfos)
        {
            LogMessage.Log(LogMessage.SeverityType.Debug, string.Format("Processing Revision {0}.", revision), _eventManager);
            PropertiesCollection toSave = new PropertiesCollection();
            foreach (string path in changedPathInfos.Keys)
            {
                IChangedPathInfo info = changedPathInfos[path];

                //// Only execute if path is a Tag (the Rev is a Copy operation, with destination including "Tags")
                if ((!path.ToUpper().Contains("/TAGS/")) || (info.Action != SubversionAction.Add) || (info.CopyFromPath == null) || (info.CopyFromRevision < 0))
                    continue;

                string pathToUse = FixPath(path);
                // get any svn:external properties, and update them to specify the revision
                PropertiesCollection properties = GetProperties(pathToUse, revision, true);
                foreach (string changedPath in properties.Keys)
                {
                    if (properties[changedPath].ContainsKey(ExternalsKey))
                    {
                        string originalValue = properties[changedPath][ExternalsKey];
                        Dictionary<string, string> updated = new Dictionary<string, string>();
                        updated.Add(ExternalsKey, UpdateValue(originalValue, info.CopyFromRevision)); // Get the revision of the copy source
                        toSave[changedPath] = updated;

                        LogMessage.Log(LogMessage.SeverityType.Debug,
                                       string.Format("Updating property \"{0}\" on \"{1}\" to value \"{2}\".", ExternalsKey, changedPath,
                                                     updated[ExternalsKey]), _eventManager);
                    }
                }
            }
            SaveProperties(toSave);
            base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos);
        }
        public PropertiesCollection GetPullRequestProperties()
        {
            VssConnection connection = Context.Connection;
            GitHttpClient gitClient  = connection.GetClient <GitHttpClient>();

            TeamProjectReference project     = ClientSampleHelpers.FindAnyProject(this.Context);
            GitRepository        repo        = GitSampleHelpers.FindAnyRepository(this.Context, project.Id);
            GitPullRequest       pullRequest = GitSampleHelpers.CreatePullRequest(this.Context, repo);

            using (new ClientSampleHttpLoggerOutputSuppression())
            {
                JsonPatchDocument patch = new JsonPatchDocument();
                patch.Add(new JsonPatchOperation()
                {
                    Operation = Operation.Add, Path = "/sampleId", Value = 8
                });
                patch.Add(new JsonPatchOperation()
                {
                    Operation = Operation.Add, Path = "/startedDateTime", Value = DateTime.UtcNow
                });

                gitClient.UpdatePullRequestPropertiesAsync(patch, repo.Id, pullRequest.PullRequestId).SyncResult();
            }

            Console.WriteLine("project {0}, repo {1}, pullRequestId {2}", project.Name, repo.Name, pullRequest.PullRequestId);

            PropertiesCollection properties = gitClient.GetPullRequestPropertiesAsync(repo.Id, pullRequest.PullRequestId).SyncResult();

            Console.WriteLine($"Pull request {pullRequest.PullRequestId} has {properties.Count} properties");

            GitSampleHelpers.AbandonPullRequest(this.Context, repo, pullRequest.PullRequestId);

            return(properties);
        }
Exemplo n.º 9
0
        public void InsertAndverifyDoor()
        {
            review3d.Click();
            doorbtn.Click();
            System.Threading.Thread.Sleep(5000);
            int     h       = canvas.Size.Height / 2;
            int     w       = canvas.Size.Width / 2;
            Actions actions = new Actions(PropertiesCollection.driver);

            actions.ClickAndHold(canvas)
            .MoveByOffset(-100, -20)
            .Release().Build().Perform();
            actions.Release();
            actions.MoveToElement(canvas, w, h).Click().Build().Perform();
            System.Threading.Thread.Sleep(5000);
            jobreview.Click();
            doors.Click();
            if (qty == "")
            {
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(PropertiesCollection.Validatemessage("1", "//*[@id='grid_MaterialsGrid_rec_0']/td[5]/div"));
            }
            else
            {
                Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(PropertiesCollection.Validatemessage(qty + 1, "//*[@id='grid_MaterialsGrid_rec_0']/td[5]/div"));
            }
        }
        public ServiceDefinition(
            String serviceType,
            Guid identifier,
            String displayName,
            String relativePath,
            RelativeToSetting relativeToSetting,
            String description,
            String toolId,
            List <LocationMapping> locationMappings = null,
            Guid serviceOwner = new Guid())
        {
            ServiceType       = serviceType;
            Identifier        = identifier;
            DisplayName       = displayName;
            RelativePath      = relativePath;
            RelativeToSetting = relativeToSetting;
            Description       = description;
            ToolId            = toolId;

            if (locationMappings == null)
            {
                locationMappings = new List <LocationMapping>();
            }

            LocationMappings = locationMappings;
            ServiceOwner     = serviceOwner;
            Properties       = new PropertiesCollection();
            Status           = ServiceStatus.Active;
        }
Exemplo n.º 11
0
        private void ActiveDocument_ActiveSegmentChanged(object sender, EventArgs e)
        {
            PropertiesCollection.Clear();
            var doc      = sender as Document;
            var segment  = doc?.ActiveSegmentPair;
            var contexts = segment?.GetParagraphUnitProperties().Contexts;

            if (contexts?.Contexts?.Count > 0)
            {
                foreach (var context in contexts.Contexts)
                {
                    var color = context.DisplayColor;

                    var sdiModel = new DsiModel
                    {
                        DisplayName = context.DisplayName,
                        Description = context.Description,
                        Code        = context.DisplayCode,
                    };
                    if (color.Name == "0")                     // it doesn't have a color set
                    {
                        sdiModel.RowColor = "White";
                    }
                    else
                    {
                        sdiModel.RowColor = "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
                    }
                    PropertiesCollection.Add(sdiModel);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportProcedureForm"/> class.
        /// </summary>
        /// <param name="dbProcedure">The Procedure DB object selected by the users to import data from.</param>
        /// <param name="importToWorksheetName">The name of the Excel worksheet where data will be imported.</param>
        public ImportProcedureForm(DbProcedure dbProcedure, string importToWorksheetName)
        {
            if (dbProcedure == null)
            {
                throw new ArgumentNullException("dbProcedure");
            }

            _dbProcedure               = dbProcedure;
            _previewDataSet            = null;
            _procedureParamsProperties = new PropertiesCollection();
            _selectedResultSetIndex    = -1;
            _sumOfResultSetsExceedsMaxCompatibilityRows = false;
            _workbookInCompatibilityMode = Globals.ThisAddIn.ActiveWorkbook.Excel8CompatibilityMode;

            InitializeComponent();

            Text = @"Import Data - " + importToWorksheetName;
            ProcedureNameLabel.Text  = dbProcedure.Name;
            OptionsWarningLabel.Text = Resources.ImportDataWillBeTruncatedWarning;
            ParametersPropertyGrid.SelectedObject = _procedureParamsProperties;
            AddSummaryFieldsCheckBox.Enabled      = Settings.Default.ImportCreateExcelTable;

            InitializeMultipleResultSetsCombo();
            PrepareParameters();
        }
Exemplo n.º 13
0
        private static void LoadProperties(XElement xElement, PropertiesCollection propertiesDictionary)
        {
            XElement parent = xElement.Elements().FirstOrDefault(x => x.Name.LocalName == XmlNames.Properties);

            if (parent != null)
            {
                IEnumerable <XElement> properties = parent.Elements();
                foreach (XElement property in properties)
                {
                    string key = property.Attribute(XmlNames.Key)?.Value;
                    if (!string.IsNullOrEmpty(key))
                    {
                        if (property.HasElements)
                        {
                            var valueElements = property.Elements().Where(x => x.Name.LocalName == XmlNames.Value);
                            if (!propertiesDictionary.ContainsKey(key))
                            {
                                propertiesDictionary.Add(key, valueElements.Select(x => Json.Deserialize(x.Value)));
                            }
                        }
                        else
                        {
                            string value = property.Value;
                            if (!propertiesDictionary.ContainsKey(key))
                            {
                                propertiesDictionary.Add(key, Json.Deserialize(value));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void TestUserStory8()
        {
            try
            {
                const String INPUT_FILE = "User.xml";
                const String AUTOR      = "Alex";
                const String CONTINUT   = "Foarte";
                const string SUBJECT    = "Covor Sierpinski";
                const string CATEGORY   = "Fractali Turtle";
                User         user       = XML.DeserializeObject <User>(FileUtils.CreateInputPath(INPUT_FILE));

                PropertiesCollection.OpenURL(Constants.START_URL);
                Panel.Log_Click();
                Authentication.Login(user);
                Panel.Galerie_Click();
                ForumClass.NavigateToCategory(CATEGORY);
                ForumClass.NavigateToSubject(SUBJECT);
                ForumClass.SearchAutor(AUTOR);
                Sincronize.Wait(7500);
                ForumClass.SearchContent(CONTINUT);
            }
            catch (Exception e)
            {
                Logger.LogException("", e);
                Assert.Fail(e.Message);
            }
        }
Exemplo n.º 15
0
        private TaskAgent(TaskAgent agentToBeCloned)
            : base(agentToBeCloned)
        {
            this.CreatedOn       = agentToBeCloned.CreatedOn;
            this.MaxParallelism  = agentToBeCloned.MaxParallelism;
            this.StatusChangedOn = agentToBeCloned.StatusChangedOn;

            if (agentToBeCloned.AssignedRequest != null)
            {
                this.AssignedRequest = agentToBeCloned.AssignedRequest.Clone();
            }

            if (agentToBeCloned.Authorization != null)
            {
                this.Authorization = agentToBeCloned.Authorization.Clone();
            }

            if (agentToBeCloned.m_properties != null && agentToBeCloned.m_properties.Count > 0)
            {
                m_properties = new PropertiesCollection(agentToBeCloned.m_properties);
            }

            if (agentToBeCloned.m_labels != null && agentToBeCloned.m_labels.Count > 0)
            {
                m_labels = new HashSet <AgentLabel>(agentToBeCloned.m_labels);
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="ExtensionInfo"/> class.
		/// </summary>
		/// <param name="name">The friendly name for the extension.</param>
		/// <param name="assemblyPath">The extension assembly path.</param>
		/// <param name="token">The assembly  public key token.</param>
		/// <param name="className">The type name of the extension class.</param>
		/// <param name="properties">The properties collection.</param>
		public ExtensionInfo(string name, string assemblyPath, string token, string className, PropertiesCollection properties)
		{
			this.name       = name;
			this.assembly   = assemblyPath;
			this.token      = token;
			this.klass      = className;
			this.properties = properties ?? new PropertiesCollection();
		}
        public ServiceDefinition Clone(Boolean includeLocationMappings)
        {
            List <LocationMapping> locationMappings = null;

            if (LocationMappings != null && includeLocationMappings)
            {
                locationMappings = new List <LocationMapping>(LocationMappings.Count);

                foreach (LocationMapping mapping in LocationMappings)
                {
                    locationMappings.Add(new LocationMapping()
                    {
                        AccessMappingMoniker = mapping.AccessMappingMoniker,
                        Location             = mapping.Location
                    });
                }
            }
            else
            {
                locationMappings = new List <LocationMapping>();
            }

            PropertiesCollection properties = null;

            if (Properties != null)
            {
                // since we are cloning, don't validate the values
                properties = new PropertiesCollection(Properties, validateExisting: false);
            }
            else
            {
                properties = new PropertiesCollection();
            }

            ServiceDefinition serviceDefinition = new ServiceDefinition()
            {
                ServiceType       = ServiceType,
                Identifier        = Identifier,
                DisplayName       = DisplayName,
                RelativePath      = RelativePath,
                RelativeToSetting = RelativeToSetting,
                Description       = Description,
                LocationMappings  = locationMappings,
                ServiceOwner      = ServiceOwner,
                ToolId            = ToolId,
                ParentServiceType = ParentServiceType,
                ParentIdentifier  = ParentIdentifier,
                Status            = Status,
                Properties        = properties,
                ResourceVersion   = ResourceVersion,
                MinVersion        = MinVersion,
                MaxVersion        = MaxVersion,
                ReleasedVersion   = ReleasedVersion
            };

            serviceDefinition.ResetModifiedProperties();
            return(serviceDefinition);
        }
Exemplo n.º 18
0
 static List <Item> PropertiesToData(PropertiesCollection properties)
 {
     return(properties
            .GetKeys()
            .Select(key => new Item {
         Key = key, Value = properties[key].ToString()
     })
            .ToList());
 }
        public void DefaultConstructorWillSetComparerToOrdinalIgnoreCaseStringComparer()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act

            // Assert
            Assert.Same(StringComparer.OrdinalIgnoreCase, propertiesCollection.Comparer);
        }
        public void ConstructorWithStringParameterIsSinglePropertyWillAddThatProperty()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection("Movie.Id");

            // Act

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }
        public void DefaultConstructorWillSetComparerToOrdinalIgnoreCaseStringComparer()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act

            // Assert
            Assert.Same(StringComparer.OrdinalIgnoreCase, propertiesCollection.Comparer);
        }
        public void ConstructorWithStringParameterIsWhitespaceStringWillNotAddAnyProperties(string whiteSpaceProperties)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(whiteSpaceProperties);

            // Act

            // Assert
            Assert.Equal(0, propertiesCollection.Count);
        }
        public void ConstructorWithEnumerableParameterWillSetComparerToOrdinalIgnoreCaseStringComparer()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(new string[0]);

            // Act

            // Assert
            Assert.Same(StringComparer.OrdinalIgnoreCase, propertiesCollection.Comparer);
        }
 protected AbstractTypeEmitter(TypeBuilder typeBuilder)
 {
     typebuilder      = typeBuilder;
     nested           = new NestedClassCollection();
     methods          = new MethodCollection();
     constructors     = new ConstructorCollection();
     properties       = new PropertiesCollection();
     events           = new EventCollection();
     name2GenericType = new Dictionary <String, GenericTypeParameterBuilder>();
 }
        public void ConstructorWithStringParameterIsWhitespaceStringWillNotAddAnyProperties(string whiteSpaceProperties)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(whiteSpaceProperties);

            // Act

            // Assert
            Assert.Equal(0, propertiesCollection.Count);
        }
        public void ConstructorWithEnumerableParameterWillSetComparerToOrdinalIgnoreCaseStringComparer()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(new string[0]);

            // Act

            // Assert
            Assert.Same(StringComparer.OrdinalIgnoreCase, propertiesCollection.Comparer);
        }
Exemplo n.º 27
0
 public void SaveJobAndVerify(string title)
 {
     Jobbtn.Click();
     NameTxt.SendKeys(title);
     PhoneTxt.Click();
     Savebtn.Click();
     System.Threading.Thread.Sleep(6000);
     Homebtn.Click();
     Assert.IsTrue(PropertiesCollection.Validatemessage("test", "/html/body/div[2]/div[2]/span[2]/a"));
 }
        public void ConstructorWithStringParameterWillExtractAllPropertiesFromTheStringAndAddThemIndividually(string properties)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(properties);

            // Act

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
            Assert.True(propertiesCollection.Contains("Movie.Title"));
        }
        public void ToStringWithNoPropertiesAddedReturnsEmptyString()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            var propertiesCollectionAsString = propertiesCollection.ToString();

            // Assert
            Assert.Equal(string.Empty, propertiesCollectionAsString);
        }
        public void AddWithNullInstanceThrowsArgumentNullException()
        {
            // Arrange
            string collection           = null;
            var    propertiesCollection = new PropertiesCollection();

            // Act

            // Assert
            Assert.Throws <ArgumentNullException>(() => propertiesCollection.Add(collection));
        }
        public void AddWithAllPropertiesDidNotExistsReturnsTrue()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            var added = propertiesCollection.Add("Movie.Id Movie.Title");

            // Assert
            Assert.True(added);
        }
        public void AddWithWhiteSpaceStringWillNotAddAnyProperties(string whiteSpaceProperty)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add(whiteSpaceProperty);

            // Assert
            Assert.Equal(0, propertiesCollection.Count);
        }
        public void AddWithSinglePropertyIgnoresWhiteSpace()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add(" Movie.Id ");

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }
        public void ConstructorWithStringParameterWillExtractAllPropertiesFromTheStringAndAddThemIndividually(string properties)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection(properties);

            // Act

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
            Assert.True(propertiesCollection.Contains("Movie.Title"));
        }
        public void AddWithSinglePropertyThatDoesNotAlreadyExistReturnsTrue()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            var added = propertiesCollection.Add("Movie.Id");

            // Assert
            Assert.True(added);
        }
        public void AddWithSinglePropertyAddsThatProperty()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add("Movie.Id");

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }
        /// <summary>
        /// Creates properties for the given <see cref="T:Newtonsoft.Json.Serialization.JsonContract" />.
        /// </summary>
        /// <param name="type">The type to create properties for.</param>
        /// <param name="memberSerialization">The member serialization mode for the type.</param>
        /// <returns>
        /// Properties for the given <see cref="T:Newtonsoft.Json.Serialization.JsonContract" />.
        /// </returns>
        protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
        {
            this.normalizedProperties = this.NormalizeProperties(this.Properties);
            this.normalizedExcludeProperties = this.NormalizeProperties(this.ExcludeProperties);

            if (this.NoPropertiesHaveBeenSpecified())
            {
                this.MarkAllPropertiesForSerialization();
            }

            return base.CreateProperties(type, memberSerialization);
        }
        private PropertiesCollection GetProperties(string target, SvnRevision asOfRevision, bool recurse)
        {
            try
            {
                PropertiesCollection result = new PropertiesCollection();
                Collection<SvnPropertyListEventArgs> output;
                SvnPropertyListArgs args = new SvnPropertyListArgs();
                args.Revision = asOfRevision;
                args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;

                client.GetPropertyList(new Uri(target), args, out output);

                foreach (SvnPropertyListEventArgs eventArgs in output) {
                    Dictionary<string, string> properties = new Dictionary<string, string>(eventArgs.Properties.Count);
                    foreach (SvnPropertyValue value in eventArgs.Properties) {
                        properties.Add(value.Key, value.StringValue);
                    }
                    result.Add(eventArgs.Path, properties);
                }

                return result;
            }
            catch(Exception ex)
            {
                OnError(ex);
            }

            return null;
        }
        public void ToStringWithNoPropertiesAddedReturnsEmptyString()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            var propertiesCollectionAsString = propertiesCollection.ToString();

            // Assert
            Assert.Equal(string.Empty, propertiesCollectionAsString);
        }
        private static IEnumerable<string> AddTypeWildcardToNameOnlyProperties(PropertiesCollection properties)
        {
            var propertiesWithNameOnly = properties.Where(IsNameOnlyProperty);
            var propertiesWithWilcardAsType = propertiesWithNameOnly.Select(p => GetFullName(Wildcard, p));

            return properties.Except(propertiesWithNameOnly).Union(propertiesWithWilcardAsType);
        }
        internal PropertiesCollection SourceProperties()
        {
            var result = new PropertiesCollection();
            var properties = new Dictionary<string, string>();
            properties.Add("svn:externals", "common svn://svn/repos/Trunk/Common");
            properties.Add("svn:mime-type", "you should never see me");
            result.Add("svn://svn/repos/Tags/Build/12/Common", properties);

            properties = new Dictionary<string, string>();
            properties.Add("svn:mime-type", "you should never see me");
            result.Add("svn://svn/repos/Tags/Build/12/Tool1", properties);
            return result;
        }
        public void AddWithWhiteSpaceStringWillNotAddAnyProperties(string whiteSpaceProperty)
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add(whiteSpaceProperty);

            // Assert
            Assert.Equal(0, propertiesCollection.Count);
        }
        public void AddWithSinglePropertyAddsThatProperty()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add("Movie.Id");

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }
        protected virtual void SaveProperties(PropertiesCollection toSave)
        {
            // Checkout each folder (top only)
            // Set the proptery on the WC
            // Commit the change
            foreach(string path in toSave.Keys)
            {
                LogMessage.Log(LogMessage.SeverityType.Info,
                                       string.Format("Saving property \"{0}\" on \"{1}\" with value \"{2}\".", ExternalsKey, path,
                                                     toSave[path][ExternalsKey]), _eventManager);

                string tempWorkingPath = Path.GetTempPath() + Path.GetRandomFileName();
                FileSys.DeleteFolder(tempWorkingPath);
                FileSys.CreateFolder(tempWorkingPath);
                int outrev = Connector.Checkout(path, tempWorkingPath, false, true);
                if (outrev >= 0)
                {
                    LogMessage.Log(LogMessage.SeverityType.Debug, "CheckOut Rev: " + outrev + " => " + path + " => " + tempWorkingPath, _eventManager);

                    Connector.SaveProperty(ExternalsKey, toSave[path][ExternalsKey], tempWorkingPath, false, false);

                    int rev = Connector.Commit(new string[] { tempWorkingPath }, false, false, CommitMessage);

                    if (rev >= 0)
                        LogMessage.Log(LogMessage.SeverityType.Debug, "Committed Working Path: " + path + " to rev " + rev, _eventManager);
                    else
                        LogMessage.Log(LogMessage.SeverityType.Error, "Failed to commit working path: " + path, _eventManager);
                } else
                    LogMessage.Log(LogMessage.SeverityType.Info, "Failed to CheckOut to Working Path: " + path + " => " + tempWorkingPath, _eventManager);

                Connector.Cleanup(tempWorkingPath);

                FileSys.DeleteFolder(tempWorkingPath, true);
            }
        }
        public void AddWithSinglePropertyThatAlreadyExistsReturnsFalse()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();
            propertiesCollection.Add("Movie.Id");

            // Act
            var added = propertiesCollection.Add("Movie.Id");

            // Assert
            Assert.False(added);
        }
        public void ConstructorWithStringParameterIsSinglePropertyWillAddThatProperty()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection("Movie.Id");

            // Act

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }
 internal PropertiesCollection ExpectedProperties(int revision)
 {
     var result = new PropertiesCollection();
     var properties = new Dictionary<string, string>();
     properties.Add("svn:externals", "common svn://svn/repos/Trunk/Common@" + revision.ToString());
     result.Add("svn://svn/repos/Tags/Build/12/Common", properties);
     return result;
 }
        public void AddWithNullInstanceThrowsArgumentNullException()
        {
            // Arrange
            string collection = null;
            var propertiesCollection = new PropertiesCollection();

            // Act
            
            // Assert
            Assert.Throws<ArgumentNullException>(() => propertiesCollection.Add(collection));
        }
 protected override void SaveProperties(PropertiesCollection toSave)
 {
     _lastSavedProperties = toSave;
 }
        public void AddWithAllPropertiesAlreadyExistedReturnsFalse()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();
            propertiesCollection.Add("Movie.Id");
            propertiesCollection.Add("Movie.Title");

            // Act
            var added = propertiesCollection.Add("Movie.Id Movie.Title");

            // Assert
            Assert.False(added);
        }
        private PropertiesCollection NormalizeProperties(PropertiesCollection properties)
        {
            if (this.PropertyMatchMode == PropertyMatchMode.Name)
            {
                return new PropertiesCollection(AddTypeWildcardToNameOnlyProperties(properties));
            }

            return properties;
        }
Exemplo n.º 52
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon = src.Icon;
            m_race = src.Race;
            m_slot = src.Slot;
            m_family = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList<Material>(0);
            m_properties = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
                return;

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="ExtensionInfo"/> class.
		/// </summary>
		/// <param name="name">The extension friendly name.</param>
		/// <param name="type">The extension class type.</param>
		public ExtensionInfo(string name, Type type)
		{
			if (string.IsNullOrEmpty(name))
				throw new ArgumentNullException("name");

			if (type == null)
				throw new ArgumentNullException("type");

			Uri path     = new Uri(type.Assembly.Location);
			Uri relative = new Uri(Assembly.GetExecutingAssembly().Location);

			this.name       = name;
			this.klass      = type.FullName;
			this.assembly   = relative.MakeRelativeUri(path).ToString();
			this.token      = Convert.ToBase64String(type.Assembly.GetName().GetPublicKeyToken());
			this.properties = new PropertiesCollection();
		}
Exemplo n.º 54
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Hierarchy" /> class with 
		/// the specified <see cref="ILoggerFactory" />.
		/// </summary>
		/// <param name="properties">The properties to pass to this repository.</param>
		/// <param name="loggerFactory">The factory to use to create new logger instances.</param>
		public Hierarchy(PropertiesCollection properties, ILoggerFactory loggerFactory) : base(properties)
		{
			if (loggerFactory == null)
			{
				throw new ArgumentNullException("loggerFactory");
			}

			m_defaultFactory = loggerFactory;

			m_ht = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
			m_root = new RootLogger(Level.DEBUG);

			m_root.Hierarchy = this;
		}
        public void AddWithOnePropertyDidNotExistsReturnsTrue()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();
            propertiesCollection.Add("Movie.Id");

            // Act
            var added = propertiesCollection.Add("Movie.Id Movie.Title");

            // Assert
            Assert.True(added);
        }
        public void ToStringWithSinglePropertyAddedReturnsThatProperty()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();
            propertiesCollection.Add("Movie.Id");

            // Act
            var propertiesCollectionAsString = propertiesCollection.ToString();

            // Assert
            Assert.Equal("Movie.Id", propertiesCollectionAsString);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="ExtensionInfo"/> class.
		/// </summary>
		public ExtensionInfo()
		{
			this.properties = new PropertiesCollection();
		}
        public void ToStringWithMultiplePropertiesAddedReturnsPropertiesSeparatedByCommas()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();
            propertiesCollection.Add("Movie.Id");
            propertiesCollection.Add("Movie.Title");

            // Act
            var propertiesCollectionAsString = propertiesCollection.ToString();

            // Assert
            Assert.Equal("Movie.Id,Movie.Title", propertiesCollectionAsString);
        }
Exemplo n.º 59
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Hierarchy" /> class.
		/// </summary>
		/// <param name="properties">The properties to pass to this repository.</param>
		public Hierarchy(PropertiesCollection properties) : this(properties, new DefaultLoggerFactory())
		{
		}
        public void AddWithSinglePropertyIgnoresWhiteSpace()
        {
            // Arrange
            var propertiesCollection = new PropertiesCollection();

            // Act
            propertiesCollection.Add(" Movie.Id ");

            // Assert
            Assert.True(propertiesCollection.Contains("Movie.Id"));
        }