public T MapEnum <T>(string setting, T defaultValue) where T : struct, Enum { if (setting == null) { return(defaultValue); } bool ok = TryParse.EnumTryParse(setting, out T result); if (!ok) { _logger.Warning( $"Invalid value ({setting}) for {typeof(T)}"); return(defaultValue); } return(result); }
private void MapDisplayName(string displaynameoptions) { if (displaynameoptions == null) { return; } var ok = TryParse.EnumTryParse(displaynameoptions, out DisplayNameOptions result); if (ok) { DisplayName = result; } else { _logger.Warning($"Invalid value ({displaynameoptions}) for DisplayNameOptions, should be either Name, Fullname or FullnameSep"); } }
public TestOutcome MapWarningOutcome(string outcome) { if (outcome == null) { return(TestOutcome.Skipped); } bool ok = TryParse.EnumTryParse(outcome, out TestOutcome testoutcome); if (!ok) { _logger.Warning( $"Invalid value ({outcome}) for MapWarningTo, should be either Skipped,Failed,Passed or None"); return(TestOutcome.Skipped); } return(testoutcome); }
private void MapTestCategory(string vsTestCategoryType) { if (vsTestCategoryType == null) { return; } var ok = TryParse.EnumTryParse(vsTestCategoryType, out VsTestCategoryType result); if (ok) { VsTestCategoryType = result; } else { _logger.Warning($"Invalid value ({vsTestCategoryType}) for VsTestCategoryType, should be either NUnit or MsTest"); } }