public void AttributeIsInvalidWhenCollectionIsNullTest() { // arrange var attribute = new MaximumSize(2); // act var actual = attribute.IsValid(null); // assert Assert.False(actual); }
public void ErrorMessageTest() { // arrange long maxSize = new Random().Next(1, 10); var expectedErrorMessage = $"{nameof(ErrorMessageTest)} can contain max {maxSize} elements."; // act var actual = new MaximumSize(maxSize); // assert StringAssert.AreEqualIgnoringCase(expectedErrorMessage, actual.ErrorMessage); }
public void AttributeIsInvalidTest() { // arrange var list = new List <string> { "test", "test", "test" }; var attribute = new MaximumSize(2); // act var actual = attribute.IsValid(list); // assert Assert.False(actual); }
public override int GetHashCode() { StringBuilder builder = new StringBuilder(); if (FontFamily != null) { builder.Append(FontFamily.ToString()); } builder.Append(FontStyle.ToString()); builder.Append(FontStretch.ToString()); builder.Append(((ushort)FontWeight.Weight).ToString()); builder.Append(WordWrap.ToString()); builder.Append(MaximumSize.ToString()); return(builder.ToString().GetHashCode()); }
internal override void BuildNodes(System.Xml.XmlElement parent, System.Xml.XmlDocument doc) { XmlElement el = doc.CreateElement("DisplayWindow"); XmlHelper.AppendAttribute(el, doc, "name", Name); XmlHelper.AppendAttribute(el, doc, "preferred_size", Size.ToString()); XmlHelper.AppendAttribute(el, doc, "minimum_size", MinimumSize.ToString()); XmlHelper.AppendAttribute(el, doc, "maximum_size", MaximumSize.ToString()); XmlHelper.AppendAttribute(el, doc, "allow_resize", AllowResize); XmlHelper.AppendAttribute(el, doc, "full_screen", FullScreen); XmlHelper.AppendAttribute(el, doc, "bpp", Bpp); el.InnerText = Title; parent.AppendChild(el); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (LogName.Expression != null) { targetCommand.AddParameter("LogName", LogName.Get(context)); } if (RetentionDays.Expression != null) { targetCommand.AddParameter("RetentionDays", RetentionDays.Get(context)); } if (OverflowAction.Expression != null) { targetCommand.AddParameter("OverflowAction", OverflowAction.Get(context)); } if (MaximumSize.Expression != null) { targetCommand.AddParameter("MaximumSize", MaximumSize.Get(context)); } if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }