public void AnchorStyleNoneToString()
        {
            AnchorStyles anchorStyle  = AnchorStyles.None;
            string       expectedText = "System::Windows::Forms::AnchorStyles.None";

            Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(anchorStyle));
        }
        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, RubyPropertyValueAssignment.ToString(anchorStyle));
        }
        public void SystemEnvironmentSpecialFolderNestedTypeToString()
        {
            Environment.SpecialFolder folder = Environment.SpecialFolder.ProgramFiles;
            string expectedText = "System::Environment::SpecialFolder.ProgramFiles";

            Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(folder));
        }
        public void DoubleQuoteCharactersEncodedInStrings()
        {
            string text         = "c:\\te\"mp";
            string expectedText = "\"c:\\\\te\\\"mp\"";

            Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(text));
        }
        public void BackslashCharactersEncodedInStrings()
        {
            string text         = @"c:\temp";
            string expectedText = "\"c:\\\\temp\"";

            Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(text));
        }
예제 #6
0
        public void ConvertCustomClass()
        {
            CustomClass customClass  = new CustomClass("Test", "Category");
            string      text         = RubyPropertyValueAssignment.ToString(customClass);
            string      expectedText = "ICSharpCode::Scripting::Tests::Utils::CustomClass.new(\"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.new(\"Times New Roman\", 8.25, System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point, 0)",
                                RubyPropertyValueAssignment.ToString(font));
            } finally {
                System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
            }
        }
예제 #8
0
        public void GeneratedCode()
        {
            string expectedCode = "    @components = System::ComponentModel::Container.new()\r\n" +
                                  "    @timer1 = System::Windows::Forms::Timer.new(@components)\r\n" +
                                  "    @contextMenuStrip1 = System::Windows::Forms::ContextMenuStrip.new(@components)\r\n" +
                                  "    self.SuspendLayout()\r\n" +
                                  "    # \r\n" +
                                  "    # contextMenuStrip1\r\n" +
                                  "    # \r\n" +
                                  "    @contextMenuStrip1.Name = \"contextMenuStrip1\"\r\n" +
                                  "    @contextMenuStrip1.Size = " + RubyPropertyValueAssignment.ToString(menuStripSize) + "\r\n" +
                                  "    # \r\n" +
                                  "    # MainForm\r\n" +
                                  "    # \r\n" +
                                  "    self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" +
                                  "    self.Name = \"MainForm\"\r\n" +
                                  "    self.ResumeLayout(false)\r\n";

            Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode);
        }
예제 #9
0
 string SizeToString(Size size)
 {
     return(RubyPropertyValueAssignment.ToString(size));
 }
        public void StringConversion()
        {
            string s = "abc";

            Assert.AreEqual("\"abc\"", RubyPropertyValueAssignment.ToString(s));
        }
 public void NullConversion()
 {
     Assert.AreEqual("nil", RubyPropertyValueAssignment.ToString(null));
 }
 public void DefaultCursorToString()
 {
     Assert.AreEqual("System::Windows::Forms::Cursors.Default", RubyPropertyValueAssignment.ToString(Cursors.Default));
 }
 public void CharConversion()
 {
     Assert.AreEqual("\"*\"", RubyPropertyValueAssignment.ToString('*'));
 }
        public void SizeFToString()
        {
            SizeF sizeF = new SizeF(4, 10);

            Assert.AreEqual("System::Drawing::SizeF.new(4, 10)", RubyPropertyValueAssignment.ToString(sizeF));
        }
 public void BoolConversion()
 {
     Assert.AreEqual("true", RubyPropertyValueAssignment.ToString(true));
 }
        public void ConvertCustomColorToString()
        {
            Color customColor = Color.FromArgb(0, 192, 10);

            Assert.AreEqual("System::Drawing::Color.FromArgb(0, 192, 10)", RubyPropertyValueAssignment.ToString(customColor));
        }
예제 #17
0
        public void ConvertCustomClass()
        {
            CustomClass customClass = new CustomClass("Test", "Category");

            Assert.AreEqual("RubyBinding::Tests::Designer::CustomClass.new(\"Test\", \"Category\")", RubyPropertyValueAssignment.ToString(customClass));
        }