-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorToSolidColorBrushConverterTests.cs
37 lines (33 loc) · 1.95 KB
/
ColorToSolidColorBrushConverterTests.cs
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
using NUnit.Framework;
using Shouldly;
using System.Windows.Media;
namespace CodingSeb.Converters.Tests
{
[TestFixture]
public class ColorToSolidColorBrushConverterTests
{
[Category("Convert")]
[Test]
public void ConvertSomeColorsIntoCorrepondingSolidColorBrush()
{
ColorToSolidColorBrushConverter converter = new ColorToSolidColorBrushConverter();
// ShouldBes sur le ToString() utiliser ici parce que dans le cas de SolidColorBrush le Equals test la référence et retourne false.
converter.Convert(Colors.Black, typeof(SolidColorBrush), null, null).ToString().ShouldBe(Brushes.Black.ToString());
converter.Convert(Colors.White, typeof(SolidColorBrush), null, null).ToString().ShouldBe(Brushes.White.ToString());
converter.Convert(Colors.Red, typeof(SolidColorBrush), null, null).ToString().ShouldBe(Brushes.Red.ToString());
converter.Convert(Colors.Blue, typeof(SolidColorBrush), null, null).ToString().ShouldBe(Brushes.Blue.ToString());
converter.Convert(Colors.Yellow, typeof(SolidColorBrush), null, null).ToString().ShouldBe(Brushes.Yellow.ToString());
}
[Category("ConvertBack")]
[Test]
public void ConvertBackSomeSolidColorBrushIntoCorrepondingColors()
{
ColorToSolidColorBrushConverter converter = new ColorToSolidColorBrushConverter();
converter.ConvertBack(Brushes.Black, typeof(SolidColorBrush), null, null).ShouldBe(Colors.Black);
converter.ConvertBack(Brushes.White, typeof(SolidColorBrush), null, null).ShouldBe(Colors.White);
converter.ConvertBack(Brushes.Red, typeof(SolidColorBrush), null, null).ShouldBe(Colors.Red);
converter.ConvertBack(Brushes.Blue, typeof(SolidColorBrush), null, null).ShouldBe(Colors.Blue);
converter.ConvertBack(Brushes.Yellow, typeof(SolidColorBrush), null, null).ShouldBe(Colors.Yellow);
}
}
}