Example #1
0
            public FactsBase()
            {
                _packageService           = new Mock <IPackageService>();
                _packageFileService       = new Mock <IPackageFileService>();
                _entitiesContext          = new Mock <IEntitiesContext>();
                _reservedNamespaceService = new Mock <IReservedNamespaceService>();
                _validationService        = new Mock <IValidationService>();

                _package = new Package
                {
                    PackageRegistration = new PackageRegistration
                    {
                        Id = Id,
                    },
                    Version = Version,
                };
                _packageFile         = Stream.Null;
                _unexpectedException = new ArgumentException("Fail!");
                _conflictException   = new FileAlreadyExistsException("Conflict!");

                _target = new PackageUploadService(
                    _packageService.Object,
                    _packageFileService.Object,
                    _entitiesContext.Object,
                    _reservedNamespaceService.Object,
                    _validationService.Object);
            }
            public FactsBase()
            {
                _packageService           = new Mock <IPackageService>();
                _packageFileService       = new Mock <IPackageFileService>();
                _entitiesContext          = new Mock <IEntitiesContext>();
                _reservedNamespaceService = new Mock <IReservedNamespaceService>();
                _validationService        = new Mock <IValidationService>();
                _config = new Mock <IAppConfiguration>();
                _config
                .SetupGet(x => x.AllowLicenselessPackages)
                .Returns(true);

                _typosquattingService = new Mock <ITyposquattingService>();

                _package = new Package
                {
                    PackageRegistration = new PackageRegistration
                    {
                        Id = Id,
                    },
                    Version = Version,
                };
                _packageFile         = Stream.Null;
                _unexpectedException = new ArgumentException("Fail!");
                _conflictException   = new FileAlreadyExistsException("Conflict!");
                _token = CancellationToken.None;
                _licenseFileService = new Mock <ICoreLicenseFileService>();
                _readmeFileService  = new Mock <ICoreReadmeFileService>();
                _diagnosticsService = new Mock <IDiagnosticsService>();

                _diagnosticsService
                .Setup(ds => ds.GetSource(It.IsAny <string>()))
                .Returns(Mock.Of <IDiagnosticsSource>());

                _vulnerabilityService = new Mock <IPackageVulnerabilitiesManagementService>();

                _metadataValidationService = new Mock <IPackageMetadataValidationService>();

                _target = new PackageUploadService(
                    _packageService.Object,
                    _packageFileService.Object,
                    _entitiesContext.Object,
                    _reservedNamespaceService.Object,
                    _validationService.Object,
                    _licenseFileService.Object,
                    _readmeFileService.Object,
                    _diagnosticsService.Object,
                    _vulnerabilityService.Object,
                    _metadataValidationService.Object);
            }