public void ShouldCastToEnumWithDefaultValue() { // Arrange int enumValue = 33; // Act var casted = EnumHelper.Cast(enumValue, defaultValue: Weekday.Mon); // Assert casted.Should().NotBeNull(); casted.Should().Be(Weekday.Mon); }
public void ShouldCastToEnum() { // Arrange int enumValue = 3; // Act var casted = EnumHelper.Cast <Weekday>(enumValue); // Assert casted.Should().NotBeNull(); casted.Should().Be(Weekday.Wed); }
public override void WriteData(TraceLoggingDataCollector collector, ref EnumType value) { collector.AddScalar(EnumHelper <sbyte> .Cast <EnumType>(value)); }
public override void Write(JsonWriter writer, T value) => writer.WriteValue(EnumHelper <T> .Cast(value));
public override T Read(JsonReader reader, Type objectType) => EnumHelper <T> .Cast(reader.ReadInt64());