-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClsColorSetTests.cs
More file actions
50 lines (44 loc) · 1.33 KB
/
ClsColorSetTests.cs
File metadata and controls
50 lines (44 loc) · 1.33 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
48
49
50
using CLSEncoderDecoder;
namespace CLSEncoderDecoderTest;
public class ClsColorSetTests
{
[Fact]
public void Load_ByteArray_DoesNotThrow()
{
var bytes = File.ReadAllBytes(@"files\valid-palette.cls");
ClsColorSet.Load(bytes);
}
[Fact]
public void Load_File_DoesNotThrow()
{
ClsColorSet.Load(@"files\valid-palette.cls");
}
[Fact]
public void Load_FileWith1Color_ColorIsCorrect()
{
var set = ClsColorSet.Load(@"files\AABBCC.cls");
Assert.Collection(
set.Colors,
a => Assert.Equal(new ClsColor(0xAA, 0xBB, 0xCC, 0xFF), a));
}
[Fact]
public void Load_Utf8Name_ParsedCorrectly()
{
string expectedUtf8 = @"a¡ࠀ𒀀";
string expectedAscii = "a????";
var colorSet = ClsColorSet.Load(@"files\unicode.cls");
Assert.Equal(expectedAscii, colorSet.AsciiName);
Assert.Equal(expectedUtf8, colorSet.Utf8Name);
}
[Theory]
[InlineData(@"files\valid-palette.cls")]
[InlineData(@"files\unicode.cls")]
[InlineData(@"files\AABBCC.cls")]
public void Save_LoadedFileIntoBytes_GetSameFile(string path)
{
var origFile = ClsColorSet.Load(path);
var saved = origFile.SaveToArray();
var parsed = ClsColorSet.Load(saved);
Assert.Equal(origFile, parsed);
}
}