コード例 #1
0
ファイル: ExpressionFixture.cs プロジェクト: he-dev/reusable
        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));
        }
コード例 #2
0
 public void Disallows_types_with_explicit_generic_arguments()
 {
     Assert.ThrowsAny <DynamicException>(() => new RewritePrettyTypeVisitor(TypeDictionary.From(typeof(List <int>))));
 }
コード例 #3
0
ファイル: TypeDictionaryTest.cs プロジェクト: he-dev/reusable
        public void Can_create_from_type_decorated_with_NamespaceAttribute()
        {
            var types = TypeDictionary.From(typeof(DecoratedType));

            Assert.True(types.ContainsKey($"Test.{nameof(DecoratedType)}"));
        }