public ExpressionFixture() { var builder = new ContainerBuilder(); builder.RegisterModule <JsonContractResolverModule>(); builder.RegisterModule(new LoggerModule(new LoggerFactory())); builder.RegisterModule(new ExpressionSerializerModule(Expression.Types)); var container = builder.Build(); _scope = container.BeginLifetimeScope(); _disposer = Disposable.Create(() => { _scope.Dispose(); container.Dispose(); }); Serializer = _scope.Resolve <ExpressionSerializer.Factory>()(TypeDictionary.From(Expression.Types)); }
public void Disallows_types_with_explicit_generic_arguments() { Assert.ThrowsAny <DynamicException>(() => new RewritePrettyTypeVisitor(TypeDictionary.From(typeof(List <int>)))); }
public void Can_create_from_type_decorated_with_NamespaceAttribute() { var types = TypeDictionary.From(typeof(DecoratedType)); Assert.True(types.ContainsKey($"Test.{nameof(DecoratedType)}")); }