public void CheckConvertStringToColor_CompareChangedColors_ShouldBeEqual(string value) { // Arrange var expectedValue = Color.Red; // Act var actualValue = (Color)stringToColorConverter.Convert(value, null, null, null); // Assert Assert.Equal(expectedValue, actualValue); }
public void TestInvalidColorReturnsTransparent(string str) { var converter = new StringToColorConverter(); var result = converter.Convert(str, typeof(SolidColorBrush), null, CultureInfo.CurrentCulture) as SolidColorBrush; Assert.That(result, Is.Not.Null); Assert.That(result.Color.A, Is.EqualTo(0x00)); }
public void TestColorConversion(string str, byte r, byte g, byte b) { var converter = new StringToColorConverter(); var result = converter.Convert(str, typeof(SolidColorBrush), null, CultureInfo.CurrentCulture) as SolidColorBrush; Assert.That(result, Is.Not.Null); Assert.That(result.Color.A, Is.EqualTo(0xFF)); Assert.That(result.Color.R, Is.EqualTo(r)); Assert.That(result.Color.G, Is.EqualTo(g)); Assert.That(result.Color.B, Is.EqualTo(b)); }
private List <TimelineItem> CreateTimelineItemsFor(DateTime from, DateTime to) { var converter = new StringToColorConverter(); // get executions for today var executions = mpdsItems.SelectMany(i => i.Executions).Where(e => e.End <= to && e.Start >= from); var groups = executions.Select(i => i.Task.Group).Distinct().ToList(); return(executions.Select(e => CreateTimelineItem(Factory.GetNonRepeatedImageNameFromName(e.Task.Group, groups), e.Start, e.End, (Color)converter.Convert(e.Task.Group, typeof(Color), null, null), true)).ToList()); }