public void OpenTypes_MapCorrectly()
        {
            var logicalType = LogicalType.Parse("syn:Maybe`1");
            var actualType = typeof(Maybe<>);

            var registry = new LogicalTypeRegistry();
            registry.AddMapping(logicalType, actualType);

            registry.LookupActualType(logicalType).Should().Be(actualType);
            registry.LookupLogicalType(actualType).Should().Be(logicalType);
        }
        public void SimpleMapping_BehavesCorrectly()
        {
            var logicalType = LogicalType.Parse("sys:String");
            var actualType = typeof(string);

            var registry = new LogicalTypeRegistry();
            registry.AddMapping(logicalType, actualType);

            registry.LookupActualType(logicalType).Should().Be(actualType);
            registry.LookupLogicalType(actualType).Should().Be(logicalType);
        }
        public void ClosedTypes_MapCorrectly()
        {
            var logicalType = LogicalType.Parse("syn:Maybe<sys:Int32>");
            var actualType = typeof(Maybe<int>);

            var registry = new LogicalTypeRegistry();
            registry.AddMapping(logicalType, actualType);

            registry.LookupActualType(logicalType).Should().Be(actualType);
            registry.LookupLogicalType(actualType).Should().Be(logicalType);
        }
        public void LookupActualTypeUsingClosedLogicalType_ViaOpenMapping()
        {
            var registry = new LogicalTypeRegistry();
            registry.AddMapping(LogicalType.Parse("syn:Result`2"), typeof(Result<,>));
            registry.AddMapping(LogicalType.Parse("sys:Int32"), typeof(int));
            registry.AddMapping(LogicalType.Parse("sys:String"), typeof(string));

            registry.LookupActualType(LogicalType.Parse("syn:Result<sys:Int32, sys:String>"))
                .Should().Be(typeof(Result<int, string>));
        }