public void ConvertBackTest() { TaskTypeConverter target = new TaskTypeConverter(); string value = "Development"; Type targetType = typeof(TaskType); object paramter = null; CultureInfo culture = null; TaskType expected = TaskType.Development; TaskType actual = (TaskType)target.ConvertBack(value, targetType, paramter, culture); Assert.AreEqual(expected, actual); value = "Documentation"; expected = TaskType.Documentation; actual = (TaskType)target.ConvertBack(value, targetType, paramter, culture); Assert.AreEqual(expected, actual); value = "Testing"; expected = TaskType.QA; actual = (TaskType)target.ConvertBack(value, targetType, paramter, culture); Assert.AreEqual(expected, actual); value = "Invalid"; expected = TaskType.Development; actual = (TaskType)target.ConvertBack(value, targetType, paramter, culture); Assert.AreEqual(expected, actual); expected = TaskType.Development; actual = (TaskType)target.ConvertBack(null, targetType, paramter, culture); Assert.AreEqual(expected, actual); }
public void ConvertTest() { TaskTypeConverter target = new TaskTypeConverter(); TaskType value = TaskType.Development; Type targetType = typeof(string); object paramter = null; CultureInfo culture = null; string expected = "Development"; string actual = target.Convert(value, targetType, paramter, culture) as string; Assert.AreEqual(expected, actual); value = TaskType.Documentation; expected = "Documentation"; actual = target.Convert(value, targetType, paramter, culture) as string; Assert.AreEqual(expected, actual); value = TaskType.QA; expected = "Testing"; actual = target.Convert(value, targetType, paramter, culture) as string; Assert.AreEqual(expected, actual); value = (TaskType)5; expected = "None"; actual = target.Convert(value, targetType, paramter, culture) as string; Assert.AreEqual(expected, actual); expected = string.Empty; actual = target.Convert(null, targetType, paramter, culture) as string; Assert.AreEqual(expected, actual); }