public static void Validate(this ITusConfiguration config)
        {
            if (config.Store == null)
            {
                throw new TusConfigurationException($"{nameof(config.Store)} cannot be null.");
            }

            if (string.IsNullOrWhiteSpace(config.UrlPath))
            {
                throw new TusConfigurationException($"{nameof(config.UrlPath)} cannot be empty.");
            }
        }
Exemplo n.º 2
0
        public OptionsTests()
        {
            var store = (ITusStore)Substitute.For(new[]
            {
                typeof(ITusStore),
                typeof(ITusCreationStore),
                typeof(ITusTerminationStore),
                typeof(ITusChecksumStore),
                typeof(ITusConcatenationStore),
                typeof(ITusExpirationStore),
                typeof(ITusCreationDeferLengthStore)
            }, new object[0]);

            // ReSharper disable once PossibleNullReferenceException
            ((ITusChecksumStore)store).GetSupportedAlgorithmsAsync(CancellationToken.None).ReturnsForAnyArgs(new[] { "sha1" });

            _mockTusConfiguration = new DefaultTusConfiguration
            {
                Store   = store,
                UrlPath = "/files"
            };
        }