コード例 #1
0
        public void ValidateFileName_FileAlredyExists()
        {
            var mockStorageService = new Mock <IKeyValuePersistenceService>();

            mockStorageService.Setup(x => x.ContainsAsync(It.IsAny <string>(), default(CancellationToken)))
            .ReturnsAsync(() => true);

            var service = new IlrFileNameValidationService(mockStorageService.Object, new FeatureFlags {
                DuplicateFileCheckEnabled = true
            }, new Mock <IJobService>().Object, new Mock <IDateTimeProvider>().Object, new Mock <IBespokeHttpClient>().Object, new ApiSettings());

            service.ValidateUniqueFileAsync("ILR-10006341-1819-20180118-023456-02.xml", 1000).Result.ValidationResult.Should()
            .Be(FileNameValidationResult.FileAlreadyExists);
        }
コード例 #2
0
        public void IsValidExtension_True(string extension)
        {
            var service = new IlrFileNameValidationService(new Mock <IKeyValuePersistenceService>().Object, new FeatureFlags(), new Mock <IJobService>().Object, new Mock <IDateTimeProvider>().Object, new Mock <IBespokeHttpClient>().Object, new ApiSettings());

            service.ValidateExtension(extension, "error").Should().BeNull();
        }