Example #1
0
            public BaseFacts()
            {
                Package = new Package
                {
                    PackageRegistration = new PackageRegistration(),
                    PackageStatusKey    = PackageStatus.Validating,
                };
                ValidationSet = new PackageValidationSet
                {
                    PackageValidations = new List <PackageValidation>
                    {
                        new PackageValidation {
                            Type = "SomeValidator"
                        },
                    }
                };

                PackageServiceMock     = new Mock <ICorePackageService>();
                PackageFileServiceMock = new Mock <IValidationPackageFileService>();
                ValidatorProviderMock  = new Mock <IValidatorProvider>();
                TelemetryServiceMock   = new Mock <ITelemetryService>();
                LoggerMock             = new Mock <ILogger <PackageStatusProcessor> >();

                PackageFileServiceMock
                .Setup(x => x.DownloadPackageFileToDiskAsync(It.IsAny <Package>()))
                .ReturnsAsync(() => Stream.Null);

                Target = new PackageStatusProcessor(
                    PackageServiceMock.Object,
                    PackageFileServiceMock.Object,
                    ValidatorProviderMock.Object,
                    TelemetryServiceMock.Object,
                    LoggerMock.Object);
            }
 public void DoesNotThrowWhenSasDefinitionConfigurationAccesssorIsNull()
 {
     var processor = new PackageStatusProcessor(
         PackageServiceMock.Object,
         PackageFileServiceMock.Object,
         ValidatorProviderMock.Object,
         TelemetryServiceMock.Object,
         null,
         LoggerMock.Object,
         CoreLicenseFileServiceMock.Object,
         CoreReadmeFileServiceMock.Object);
 }
            public BaseFacts()
            {
                Package = new Package
                {
                    PackageRegistration = new PackageRegistration(),
                    PackageStatusKey    = PackageStatus.Validating,
                };
                ValidationSet = new PackageValidationSet
                {
                    PackageValidations = new List <PackageValidation>
                    {
                        new PackageValidation {
                            Type = "SomeValidator"
                        },
                    }
                };

                PackageServiceMock         = new Mock <IEntityService <Package> >();
                PackageFileServiceMock     = new Mock <IValidationFileService>();
                ValidatorProviderMock      = new Mock <IValidatorProvider>();
                TelemetryServiceMock       = new Mock <ITelemetryService>();
                LoggerMock                 = new Mock <ILogger <EntityStatusProcessor <Package> > >();
                CoreLicenseFileServiceMock = new Mock <ICoreLicenseFileService>();
                CoreReadmeFileServiceMock  = new Mock <ICoreReadmeFileService>();

                var streamMetadata = new PackageStreamMetadata()
                {
                    Size          = 1,
                    Hash          = "hash",
                    HashAlgorithm = CoreConstants.Sha512HashAlgorithmId
                };

                SasDefinitionConfiguration = new SasDefinitionConfiguration()
                {
                    PackageStatusProcessorSasDefinition = "PackageStatusProcessorSasDefinition"
                };
                SasDefinitionConfigurationMock = new Mock <IOptionsSnapshot <SasDefinitionConfiguration> >();
                SasDefinitionConfigurationMock.Setup(x => x.Value).Returns(() => SasDefinitionConfiguration);

                Target = new PackageStatusProcessor(
                    PackageServiceMock.Object,
                    PackageFileServiceMock.Object,
                    ValidatorProviderMock.Object,
                    TelemetryServiceMock.Object,
                    SasDefinitionConfigurationMock.Object,
                    LoggerMock.Object,
                    CoreLicenseFileServiceMock.Object,
                    CoreReadmeFileServiceMock.Object);

                PackageValidatingEntity = new PackageValidatingEntity(Package);
            }
            public void DoesNotThrowWhenSasDefinitionConfigurationAccesssorValueIsNull()
            {
                var sasDefinitionConfigurationMock = new Mock <IOptionsSnapshot <SasDefinitionConfiguration> >();

                sasDefinitionConfigurationMock.Setup(x => x.Value).Returns(() => (SasDefinitionConfiguration)null);

                var processor = new PackageStatusProcessor(
                    PackageServiceMock.Object,
                    PackageFileServiceMock.Object,
                    ValidatorProviderMock.Object,
                    TelemetryServiceMock.Object,
                    SasDefinitionConfigurationMock.Object,
                    LoggerMock.Object,
                    CoreLicenseFileServiceMock.Object,
                    CoreReadmeFileServiceMock.Object);
            }
            public BaseFacts()
            {
                Package = new Package
                {
                    PackageRegistration = new PackageRegistration(),
                    PackageStatusKey    = PackageStatus.Validating,
                };
                ValidationSet = new PackageValidationSet
                {
                    PackageValidations = new List <PackageValidation>
                    {
                        new PackageValidation {
                            Type = "SomeValidator"
                        },
                    }
                };

                PackageServiceMock         = new Mock <IEntityService <Package> >();
                PackageFileServiceMock     = new Mock <IValidationFileService>();
                ValidatorProviderMock      = new Mock <IValidatorProvider>();
                TelemetryServiceMock       = new Mock <ITelemetryService>();
                LoggerMock                 = new Mock <ILogger <EntityStatusProcessor <Package> > >();
                CoreLicenseFileServiceMock = new Mock <ICoreLicenseFileService>();

                var streamMetadata = new PackageStreamMetadata()
                {
                    Size          = 1,
                    Hash          = "hash",
                    HashAlgorithm = CoreConstants.Sha512HashAlgorithmId
                };

                PackageFileServiceMock
                .Setup(x => x.UpdatePackageBlobMetadataAsync(It.IsAny <PackageValidationSet>()))
                .ReturnsAsync(streamMetadata);

                Target = new PackageStatusProcessor(
                    PackageServiceMock.Object,
                    PackageFileServiceMock.Object,
                    ValidatorProviderMock.Object,
                    TelemetryServiceMock.Object,
                    LoggerMock.Object,
                    CoreLicenseFileServiceMock.Object);

                PackageValidatingEntity = new PackageValidatingEntity(Package);
            }