public void AnchorStyleToString() { AnchorStyles anchorStyle = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; string expectedText = "System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right"; Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(anchorStyle)); }
public void ConvertCustomClass() { CustomClass customClass = new CustomClass("Test", "Category"); string text = PythonPropertyValueAssignment.ToString(customClass); string expectedText = "ICSharpCode.Scripting.Tests.Utils.CustomClass(\"Test\", \"Category\")"; Assert.AreEqual(expectedText, text); }
public void FontToString() { CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; try { System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE"); Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); Assert.AreEqual("System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)", PythonPropertyValueAssignment.ToString(font)); } finally { System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; } }
public void GeneratedCode() { string expectedCode = " self._components = System.ComponentModel.Container()\r\n" + " self._timer1 = System.Windows.Forms.Timer(self._components)\r\n" + " self._contextMenuStrip1 = System.Windows.Forms.ContextMenuStrip(self._components)\r\n" + " self.SuspendLayout()\r\n" + " # \r\n" + " # contextMenuStrip1\r\n" + " # \r\n" + " self._contextMenuStrip1.Name = \"contextMenuStrip1\"\r\n" + " self._contextMenuStrip1.Size = " + PythonPropertyValueAssignment.ToString(menuStripSize) + "\r\n" + " # \r\n" + " # MainForm\r\n" + " # \r\n" + " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + " self.Name = \"MainForm\"\r\n" + " self.ResumeLayout(False)\r\n"; Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); }
string SizeToString(Size size) { return(PythonPropertyValueAssignment.ToString(size)); }
public void SizeFToString() { SizeF sizeF = new SizeF(4, 10); Assert.AreEqual("System.Drawing.SizeF(4, 10)", PythonPropertyValueAssignment.ToString(sizeF)); }
public void ConvertCustomColorToString() { Color customColor = Color.FromArgb(0, 192, 10); Assert.AreEqual("System.Drawing.Color.FromArgb(0, 192, 10)", PythonPropertyValueAssignment.ToString(customColor)); }
public void CharConversion() { Assert.AreEqual("\"*\"", PythonPropertyValueAssignment.ToString('*')); }
public void NullConversion() { Assert.AreEqual("None", PythonPropertyValueAssignment.ToString(null)); }
public void DefaultCursorToString() { Assert.AreEqual("System.Windows.Forms.Cursors.Default", PythonPropertyValueAssignment.ToString(Cursors.Default)); }
public void ConvertCustomClass() { CustomClass customClass = new CustomClass("Test", "Category"); Assert.AreEqual("PythonBinding.Tests.Designer.CustomClass(\"Test\", \"Category\")", PythonPropertyValueAssignment.ToString(customClass)); }