-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPaletteTests.cs
More file actions
47 lines (41 loc) · 1.31 KB
/
Copy pathPaletteTests.cs
File metadata and controls
47 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NETMapnik.Test
{
[TestClass]
public class PaletteTests
{
[TestMethod]
public void Palette_Init_RGBAString()
{
Palette p = new Palette("\x01\x02\x03\x04");
Assert.AreEqual("[Palette 1 color #01020304]", p.ToString());
}
[TestMethod]
public void Palette_Init_RGBString()
{
Palette p = new Palette("\x01\x02\x03", PaletteType.PALETTE_RGB);
Assert.AreEqual("[Palette 1 color #010203]", p.ToString());
}
[TestMethod]
[ExpectedException(typeof(Exception))]
public void Palette_Init_RGBString_NoType()
{
Palette p = new Palette("\x01\x02\x03");
}
[TestMethod]
public void Palette_Init_RGBABytes()
{
byte[] bytes = new byte[4] { 0x01, 0x02, 0x03, 0x04 };
Palette p = new Palette(bytes);
Assert.AreEqual("[Palette 1 color #01020304]", p.ToString());
}
[TestMethod]
public void Palette_ToBytes()
{
byte[] bytes = new byte[4] { 0x01, 0x02, 0x03, 0x04 };
Palette p = new Palette("\x01\x02\x03\x04");
CollectionAssert.AreEqual(bytes, p.ToBytes());
}
}
}