[bcl] Remove more NET_2_0 checks from class libs
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing.Printing / PageSourceTest.cs
1 //
2 // Copyright (C) 2009 Novell, Inc (http://www.novell.com)
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23 // Author:
24 //      Andy Hume <andyhume32@yahoo.co.uk>
25 //
26
27 using NUnit.Framework;
28 using System;
29 using System.Drawing;
30 using System.Drawing.Printing;
31
32 namespace MonoTests.System.Drawing.Printing
33 {       
34         [TestFixture]
35         public class PaperSourceTest
36         {
37                 [Test]
38                 public void KindTest ()
39                 {
40                         PaperSource ps = new PaperSource ();
41
42                         //
43                         // Set Custom
44                         ps.RawKind = (int)PaperSourceKind.Custom;
45                         Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #8");
46                         Assert.AreEqual (257, ps.RawKind, "RawKind #8");
47
48                         //
49                         // An integer value of 256 and above returns Custom (0x257)
50                         ps.RawKind = 256;
51                         Assert.AreEqual (256, ps.RawKind, "out: #" + 256);
52                         Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "kind is custom: #" + 256);
53
54                         //
55                         // Zero
56                         ps.RawKind = 0;
57                         Assert.AreEqual ((PaperSourceKind)0, ps.Kind, "Kind #1");
58                         Assert.AreEqual (0, ps.RawKind, "RawKind #1");
59
60                         //
61                         // Well-known
62                         ps.RawKind = (int)PaperSourceKind.Upper;
63                         Assert.AreEqual (PaperSourceKind.Upper, ps.Kind, "Kind #2");
64                         Assert.AreEqual ((int)PaperSourceKind.Upper, ps.RawKind, "RawKind #2");
65
66                         //
67                         ps.RawKind = (int)PaperSourceKind.FormSource;
68                         Assert.AreEqual (PaperSourceKind.FormSource, ps.Kind, "Kind #3");
69                         Assert.AreEqual ((int)PaperSourceKind.FormSource, ps.RawKind, "RawKind #3");
70
71                         //
72                         // Too Big
73                         ps.RawKind = 999999;
74                         Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #4");
75                         Assert.AreEqual (999999, ps.RawKind, "RawKind #4");
76
77                         //
78                         ps.RawKind = int.MaxValue;
79                         Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #5");
80                         Assert.AreEqual (int.MaxValue, ps.RawKind, "RawKind #5");
81
82                         //
83                         // Negative -- Looks as if MSFT forgot to check for negative!
84                         ps.RawKind = -1;
85                         Assert.AreEqual ((PaperSourceKind)(-1), ps.Kind, "Kind #6");
86                         Assert.AreEqual (-1, ps.RawKind, "RawKind #6");
87
88                         //
89                         ps.RawKind = int.MinValue;
90                         Assert.AreEqual ((PaperSourceKind)(int.MinValue), ps.Kind, "Kind #7");
91                         Assert.AreEqual (int.MinValue, ps.RawKind, "RawKind #7");
92                 }
93
94         }
95
96 }
97