1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
23 // Pedro MartÃnez Juliá <pedromj@gmail.com>
29 using NUnit.Framework;
32 using System.Windows.Forms;
33 using System.ComponentModel;
34 using System.Collections;
35 using System.Globalization;
37 namespace MonoTests.System.Windows.Forms {
40 public class DataGridViewCellStyleTest : Assertion {
42 DataGridViewCellStyle style;
45 public void GetReady() {
46 style = new DataGridViewCellStyle();
51 style = new DataGridViewCellStyle();
55 public void TestDefaultValues () {
56 AssertEquals("Alignment property", DataGridViewContentAlignment.NotSet, style.Alignment);
57 AssertEquals("BackColor property", Color.Empty, style.BackColor);
58 AssertEquals("Font property", null, style.Font);
59 AssertEquals("ForeColor property", Color.Empty, style.ForeColor);
60 AssertEquals("Format property", String.Empty, style.Format);
61 AssertEquals("FormatProvider property", CultureInfo.CurrentUICulture, style.FormatProvider);
62 AssertEquals("IsFormatProviderDefault property", true, style.IsFormatProviderDefault);
63 AssertEquals("IsNullValueDefault property", true, style.IsNullValueDefault);
64 AssertEquals("NullValue property", "(null)", style.NullValue);
65 AssertEquals("SelectionBackColor property", Color.Empty, style.SelectionBackColor);
66 AssertEquals("SelectionForeColor property", Color.Empty, style.SelectionForeColor);
67 AssertEquals("Tag property", null, style.Tag);
68 AssertEquals("WrapMode property", DataGridViewTriState.NotSet, style.WrapMode);
72 public void TestApplyStyle () {
73 DataGridViewCellStyle style_aux = new DataGridViewCellStyle();
74 style.ApplyStyle(style_aux);
75 AssertEquals("ApplyStyle method", style_aux, style);
79 public void TestClone () {
80 DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
81 AssertEquals("Clone method", style_aux, style);
85 public void TestEquals () {
86 DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
87 AssertEquals("Equals method", true, (style_aux.Equals(style)));
91 [ExpectedException(typeof(InvalidEnumArgumentException))]
92 public void TestAlignmentInvalidEnumArgumentException () {
93 style.Alignment = DataGridViewContentAlignment.BottomCenter | DataGridViewContentAlignment.BottomRight;
97 [ExpectedException(typeof(ArgumentException))]
98 public void TestSelectionBackColorArgumentException () {
99 style.SelectionBackColor = Color.FromArgb(100, Color.Red);
103 [ExpectedException(typeof(InvalidEnumArgumentException))]
104 public void TestWrapModeInvalidEnumArgumentException () {
105 style.WrapMode = (DataGridViewTriState) 3;
110 [ExpectedException(typeof(Exception))]
111 public void TestException () {
112 ConcreteCollection myCollection;
113 myCollection = new ConcreteCollection();
115 AssertEquals ("#UniqueID", expected, actual);