public void Convert_HydraRingCombinationType_ReturnCombinationType(HydraRingCombinationType hydraRingCombinationType, CombinationType expectedCombinationType) { // Call CombinationType combinationType = CombinationTypeConverter.Convert(hydraRingCombinationType); // Assert Assert.AreEqual(expectedCombinationType, combinationType); }
/// <summary> /// Creates a <see cref="CombinationType"/> based on <see cref="HydraRingCombinationType"/>. /// </summary> /// <param name="hydraRingCombinationType">The <see cref="HydraRingCombinationType"/> /// to convert.</param> /// <returns>The <see cref="CombinationType"/>.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown when /// <paramref name="hydraRingCombinationType"/> has an invalid value.</exception> /// <exception cref="NotSupportedException">Thrown when a valid value of /// <paramref name="hydraRingCombinationType"/> cannot be converted.</exception> public static CombinationType Convert(HydraRingCombinationType hydraRingCombinationType) { if (!Enum.IsDefined(typeof(HydraRingCombinationType), hydraRingCombinationType)) { throw new InvalidEnumArgumentException(nameof(hydraRingCombinationType), (int)hydraRingCombinationType, typeof(HydraRingCombinationType)); } switch (hydraRingCombinationType) { case HydraRingCombinationType.Or: return(CombinationType.Or); case HydraRingCombinationType.And: return(CombinationType.And); default: throw new NotSupportedException(); } }