using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using MontoyaTech.Rest.Net;
using Xunit;

namespace Rest.Net.Tests
{
    public class RouteArgumentConverterTests
    {
        public enum TestEnum : long
        {
            A = 1,
            B = 2,
            C = 3
        }

        [Fact]
        public static void RouteArgumentConverter_Should_Convert_To_Enum()
        {
            var converted = RouteArgumentConverter.Convert<TestEnum>("1");

            converted.GetType().IsEquivalentTo(typeof(TestEnum)).Should().BeTrue();

            converted.Should().Be(TestEnum.A);
        }

        [Fact]
        public static void RouteArgumentConverter_Should_Convert_OutOfRange_To_Enum()
        {
            var converted = RouteArgumentConverter.Convert<TestEnum>("4");

            converted.GetType().IsEquivalentTo(typeof(TestEnum)).Should().BeTrue();

            ((int)converted).Should().Be(4);
        }
    }
}