コード例 #1
0
        public static IServiceCollection AddDocumentManagementHost(this IServiceCollection services, DocumentManagementApiOptions options)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }


            var loader  = new LicenseLoader();
            var license = loader.TryGetLicense();

            if (license.ExpirationDateTime < DateTime.UtcNow)
            {
                throw new LicenseExpiredException();
            }

            services.AddSingleton(options);
            services.AddDocumentManagementCore();
            return(services);
        }
        public void When_Trying_To_GetLicense_File_Then_Informations_Are_Returned()
        {
            var directory = Path.Combine(Directory.GetCurrentDirectory(), "Certificates");

            Environment.SetEnvironmentVariable("SID_LICENSE", directory);
            var loader  = new LicenseLoader();
            var license = loader.TryGetLicense();
            var t       = "";
        }