public void Works_with_1_int_action_and_2_null_possible_arguments_and_1_string_mandatory_argument() { var function = new Action<int>(x => { }); var sut = new Mandatory(function, new object[] { null, null }, "x"); var e = sut.GetEnumerator(); IsFalse(e.MoveNext()); }
public void Works_with_empty_action_and_1_string_mandatory_argument() { var function = new Action(() => { }); var sut = new Mandatory(function, new object[0], "x"); var e = sut.GetEnumerator(); IsFalse(e.MoveNext()); }
public void Works_with_1_string_action_and_1_string_mandatory_argument() { var result = ""; var function = new Action<string>(x => { result = x; }); var sut = new Mandatory(function, new object[0], "x"); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual("x", result); IsFalse(e.MoveNext()); }
public void Works_with_1_nullable_int_action_and_2_null_possible_arguments_and_1_int_mandatory_argument() { var result = ""; var function = new Action<int?>(x => { result = Convert.ToString(x); }); var sut = new Mandatory(function, new object[] { null, null }, 1); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual("1", result); IsFalse(e.MoveNext()); }
public override int GetHashCode() { unchecked { var hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Definition != null ? Definition.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Tab != null ? Tab.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Mandatory.GetHashCode(); hashCode = (hashCode * 397) ^ (Validation != null ? Validation.GetHashCode() : 0); return(hashCode); } }
public NameValueCollection ToQueryString() { NameValueCollection tor = DocumentInfo.ToQueryString(); tor.Add("DocType", DocType); tor.Add("Description", Description); tor.Add("IdOwner", IdOwner); tor.Add("Mandatory", Mandatory.ToString()); tor.Add("MandatorySelectable", MandatorySelectable.ToString()); tor.Add("GroupCode", GroupCode); tor.Add("EffectiveSigner", EffectiveSigner); return(tor); }
/// <summary> /// Defines the associations for the entity Course. /// </summary> /// <param name="modelbuilder"></param> private void RelationshipsForCourse(DbModelBuilder modelbuilder) { modelbuilder.Entity <Course>() .HasRequired(y => y.Abbreviation) .WithMany(y => y.Courses) .HasForeignKey(y => y.AbbreviationID) .WillCascadeOnDelete(false); modelbuilder.Entity <Course>() .HasRequired(y => y.University) .WithMany(y => y.Courses) .HasForeignKey(y => y.UniversityID) .WillCascadeOnDelete(false); modelbuilder.Entity <Course>().HasMany(y => y.MandatoryPrerequisites).WithMany().Map( Mandatory => { Mandatory.MapLeftKey("CourseID"); Mandatory.MapRightKey("AssumedKnowledgeID"); Mandatory.ToTable("AssumedKnowledge"); }); modelbuilder.Entity <Course>().HasMany(y => y.OptionalPrerequisites).WithMany().Map( Mandatory => { Mandatory.MapLeftKey("CourseID"); Mandatory.MapRightKey("AlternativeAKID"); Mandatory.ToTable("AlternativeAssumedKnowledge"); }); modelbuilder.Entity <Course>() .HasOptional(y => y.Replacement) .WithRequired(y => y.ReplacementCourse); modelbuilder.Entity <Course>() .HasMany(y => y.Directeds) .WithRequired(y => y.Course) .HasForeignKey(y => y.CourseID) .WillCascadeOnDelete(false); modelbuilder.Entity <Course>() .HasMany(y => y.MajorCores); modelbuilder.Entity <Course>() .HasMany(y => y.DegreeCores) .WithRequired(y => y.Course) .HasForeignKey(y => y.CourseID) .WillCascadeOnDelete(false); }
public XmlNode ToXml(XmlDocument xd) { XmlNode f = umbraco.xmlHelper.addTextNode(xd, "field", string.Empty); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "id", Id.ToString())); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "caption", Caption)); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "sortorder", SortOrder.ToString())); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "mandatory", Mandatory.ToString())); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "form", Form.ToString())); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "fieldset", FieldSet.ToString())); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "regex", RegEx)); f.AppendChild(umbraco.xmlHelper.addTextNode(xd, "fieldtype", FieldType.Id.ToString())); return(f); }
public Constraint <T> FindConstraint <T>(string key, out bool mandatory, T defaultVal) { if (Mandatory.Any(c => c.Key == key)) { mandatory = true; var constraint = Mandatory.First(c => c.Key == key); return(constraint as Constraint <T> ?? new Constraint <T>(constraint)); } mandatory = false; if (Optional.Any(c => c.Key == key)) { var constraint = Optional.First(c => c.Key == key); return(constraint as Constraint <T> ?? new Constraint <T>(constraint)); } return(null); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { unchecked { int result = 17; result = result * 23 + base.GetHashCode(); result = result * 23 + ((Name != null) ? Name.GetHashCode() : 0); result = result * 23 + Type.GetHashCode(); result = result * 23 + Editable.GetHashCode(); result = result * 23 + Mandatory.GetHashCode(); result = result * 23 + Hidden.GetHashCode(); result = result * 23 + Hideable.GetHashCode(); result = result * 23 + Width.GetHashCode(); result = result * 23 + ((Text != null) ? Text.GetHashCode() : 0); result = result * 23 + Xtype.GetHashCode(); result = result * 23 + Align.GetHashCode(); result = result * 23 + ((Tooltip != null) ? Tooltip.GetHashCode() : 0); result = result * 23 + Sortable.GetHashCode(); result = result * 23 + SortDirection.GetHashCode(); result = result * 23 + ((Format != null) ? Format.GetHashCode() : 0); result = result * 23 + DecimalPlaces.GetHashCode(); result = result * 23 + ((DataUrl != null) ? DataUrl.GetHashCode() : 0); result = result * 23 + ((DefaultValue != null) ? DefaultValue.GetHashCode() : 0); result = result * 23 + ((Description != null) ? Description.GetHashCode() : 0); result = result * 23 + Rank.GetHashCode(); result = result * 23 + ReadOnly.GetHashCode(); result = result * 23 + MaxLength.GetHashCode(); result = result * 23 + ((Validator != null) ? Validator.GetHashCode() : 0); result = result * 23 + ((SearchFieldDefinition != null) ? SearchFieldDefinition.GetHashCode() : 0); result = result * 23 + SingleComboFilter.GetHashCode(); result = result * 23 + AllowComboCustomValue.GetHashCode(); result = result * 23 + SearchComboFromLeft.GetHashCode(); result = result * 23 + LoadWhenVisible.GetHashCode(); result = result * 23 + Nullable.GetHashCode(); result = result * 23 + ((Tpl != null) ? Tpl.GetHashCode() : 0); result = result * 23 + MinCharSearch.GetHashCode(); result = result * 23 + ((AdditionalWhereSqlTemp != null) ? AdditionalWhereSqlTemp.GetHashCode() : 0); return(result); } }
public void Works_with_1_int_1_string_func_and_1_int_2_string_possible_arguments_and_1_string_mandatory_argument() { var function = new Func<int, string, string>((x, y) => y + x); var sut = new Mandatory(function, new object[] { 1, "a", "b" }, "x"); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual("x1", e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }
public void Works_with_1_int_action_and_2_int_1_string_possible_arguments_and_1_int_mandatory_argument() { object result = -1; var function = new Action<int>(x => { result = x; }); var sut = new Mandatory(function, new object[] { 1, 2, "a" }, 3); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual(3, result); IsFalse(e.MoveNext()); }
protected bool Equals(GenericProperty other) { return(base.Equals(other) && string.Equals(Type, other.Type) && string.Equals(Definition, other.Definition) && string.Equals(Tab, other.Tab) && Mandatory.Equals(other.Mandatory) && string.Equals(Validation, other.Validation)); }
public void Works_with_1_int_func_and_1_string_mandatory_argument() { var function = new Func<int, int>(x => x); var sut = new Mandatory(function, new object[0], "x"); var e = sut.GetEnumerator(); IsFalse(e.MoveNext()); }
public void Works_with_1_int_func_and_1_int_mandatory_argument() { var function = new Func<int, int>(x => x); var sut = new Mandatory(function, new object[0], 1); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual(1, e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }
public void Works_with_3_string_func_and_2_int_2_string_possible_arguments_and_1_string_mandatory_argument() { var function = new Func<string, string, string, string>((x, y, z) => z + y + x); var sut = new Mandatory(function, new object[] { 1, 2, "a", "b" }, "x"); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual("aax", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("bax", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("abx", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("bbx", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("axa", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("bxa", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("axb", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("bxb", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xaa", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xba", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xab", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xbb", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("axx", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("bxx", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xax", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xbx", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xxa", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xxb", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("xxx", e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }
public void Works_with_1_int_func_and_2_int_1_string_possible_arguments_and_1_int_mandatory_argument() { var function = new Func<int, int>(x => x); var sut = new Mandatory(function, new object[] { 1, 2, "a" }, 3); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual(3, e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }
public void Works_with_1_string_1_nullable_int_action_and_2_null_1_int_possible_arguments_and_1_string_mandatory_argument() { var result = ""; var function = new Action<int?, string>((x, y) => { result = y + x; }); var sut = new Mandatory(function, new object[] { null, null, 1 }, "x"); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual("x", result);// 1null x IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual("x", result); // 2null x IsTrue(e.MoveNext()); e.Current.Function.DynamicInvoke(); AreEqual("x1", result); // 1 x IsFalse(e.MoveNext()); }
public void Works_with_1_int_1_string_func_and_1_int_possible_argument_and_1_int_mandatory_argument() { var function = new Func<int, string, string>((x, y) => y + x); var sut = new Mandatory(function, new object[] { 1 }, 2); var e = sut.GetEnumerator(); IsFalse(e.MoveNext()); }
public void Works_with_2_int_func_and_1_int_possible_argument_and_1_int_mandatory_argument() { var function = new Func<int, int, int>((x, y) => x + y); var sut = new Mandatory(function, new object[] { 1 }, 2); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual(3, e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual(3, e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual(4, e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }
public void Works_with_2_string_func_and_2_string_possible_arguments_and_1_int_mandatory_argument() { var function = new Func<string, string, string>((x, y) => x + y); var sut = new Mandatory(function, new object[] { "a", "b" }, 1); var e = sut.GetEnumerator(); IsFalse(e.MoveNext()); }
/// <inheritdoc /> public UpdateInfoEventArgs() { Mandatory = new Mandatory(); }
public void Works_with_2_int_1_string_func_and_2_int_2_string_possible_arguments_and_1_int_mandatory_argument() { var function = new Func<int, int, string, string>((x, y, z) => z + y + x); var sut = new Mandatory(function, new object[] { 1, 2, "a", "b" }, 3); var e = sut.GetEnumerator(); IsTrue(e.MoveNext()); AreEqual("a13", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("b13", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("a23", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("b23", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("a31", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("b31", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("a32", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("b32", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("a33", e.Current.Function.DynamicInvoke()); IsTrue(e.MoveNext()); AreEqual("b33", e.Current.Function.DynamicInvoke()); IsFalse(e.MoveNext()); }