Ejemplo n.º 1
0
 public override void Visit(NominalType type)
 {
     Console.WriteLine($"T: {type.Name}");
     if (type.Name.Names.Count != 1)
     {
         throw new NotImplementedException();
     }
     if (type.Arguments != null)
     {
         foreach (var arg in type.Arguments.Items)
         {
             arg.Accept(this);
         }
     }
 }
        public void Adapt_SplatsParameters_WithNominalType()
        {
            // Arrange
            var adapter = new ProxyDiagnosticSourceMethodAdapter();

            var listener = new Listener3();
            var value    = new NominalType()
            {
                Id = 17, Person = new Person()
                {
                    Name = "Bill"
                }
            };
            var method = GetMethodInfo <Listener3>(l => l.Listen(0, null));

            // Act
            var func = adapter.Adapt(method, value.GetType());

            // Assert
            Assert.True(func(listener, value));
            Assert.Equal(17, listener.Id);
            Assert.Equal("Bill", listener.Name);
        }