示例#1
0
 public static ITestScope Namespace <T>(NamespaceOptions options)
 {
     if (options == NamespaceOptions.ExactNamespaceOnly)
     {
         return(new NamespaceScope(typeof(T)));
     }
     else
     {
         return(new OrTestScope(
                    new NamespaceScope(typeof(T)),
                    new ChildNamespaceScope(typeof(T))));
     }
 }
 /// <inheritdoc/>
 public void OpenNamespace(string nsName, NamespaceOptions options = null)
 {
     using (var nsNameRx = nsName.GetHandle())
         Assert.ThrowIfError(() =>
         {
             reindexer_error rsp = default;
             for (int retry = 0; retry < 2; retry++)
             {
                 rsp = ReindexerBinding.reindexer_open_namespace(Rx, nsNameRx, options ?? new NamespaceOptions(), _ctxInfo);
                 if (rsp.code != 0)
                 {
                     ReindexerBinding.reindexer_close_namespace(Rx, nsNameRx, _ctxInfo);
                 }
             }
             return(rsp);
         });
 }
示例#3
0
        public IServiceCollection Register(IServiceCollection services, NamespaceOptions namespaces)
        {
            Services   = services;
            Namespaces = namespaces;

            if (namespaces.HasScoped)
            {
                RegisterScoped();
            }
            if (namespaces.HasTransient)
            {
                RegisterTransient();
            }
            if (namespaces.HasSingleton)
            {
                RegisterSingleton();
            }

            return(Services);
        }
 /// <inheritdoc/>
 public Task OpenNamespaceAsync(string nsName, NamespaceOptions options = null)
 {
     OpenNamespace(nsName, options);
     return(Task.CompletedTask);
 }