public void ProcessFieldDefinition_NameIsSet_ToStringReturnsName()
        {
            const string Name = "name";
            var field = new ProcessFieldDefinition() { Name = Name };

            Assert.AreEqual(Name, field.ToString());
        }
Пример #2
0
        public void GetAllFieldsTest()
        {
            // Arrange.
            var baseProcess = new ProcessDefinition("BaseProcess");
            var field1 = new ProcessFieldDefinition { Name = "Field1" };
            baseProcess.FieldList.Add(field1);

            var derivedProcess = new ProcessDefinition("DerivedProcess") { BaseProcess = baseProcess };
            var field2 = new ProcessFieldDefinition { Name = "Field2" };
            derivedProcess.FieldList.Add(field2);

            // Act.
            var allFields = derivedProcess.GetAllFields().ToList();

            // Assert.
            Assert.AreEqual(2, allFields.Count);
            Assert.IsTrue(allFields.Contains(field1));
            Assert.IsTrue(allFields.Contains(field2));
        }
 public void Create_ReturnsValidDefinition()
 {
     var d = new ProcessFieldDefinition();
     Assert.AreEqual(0, d.SecurityConfigurationList.Count);
 }
Пример #4
0
        /// <summary>
        /// Gets the fields used in security configurations.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <returns>IEnumerable{System.String}.</returns>
        private static IEnumerable<string> GetFieldsUsedInSecurityConfigurations(ProcessFieldDefinition field)
        {
            var fields = new HashSet<string>();

            foreach (var securityConfiguration in field.SecurityConfigurationList)
            {
                if (securityConfiguration.StateGuid != Guid.Empty && securityConfiguration.StateGuid != Constants.AllStatesGuid)
                {
                    fields.Add(Constants.CurrentStateColumnName);
                    fields.Add(Constants.CurrentStateIdColumnName);
                }

                if (!string.IsNullOrWhiteSpace(securityConfiguration.PersonFieldName) && field.Name != securityConfiguration.PersonFieldName)
                {
                    fields.Add(securityConfiguration.PersonFieldName);
                }
            }

            return fields;
        }