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);
        }
Example #3
0
 public override void WriteData(TraceLoggingDataCollector collector, ref EnumType value)
 {
     collector.AddScalar(EnumHelper <sbyte> .Cast <EnumType>(value));
 }
Example #4
0
 public override void Write(JsonWriter writer, T value) => writer.WriteValue(EnumHelper <T> .Cast(value));
Example #5
0
 public override T Read(JsonReader reader, Type objectType) => EnumHelper <T> .Cast(reader.ReadInt64());