示例#1
0
        private Mock <PackageService> SetupPackageService()
        {
            var packageRegistrationRepository = new Mock <IEntityRepository <PackageRegistration> >();

            packageRegistrationRepository
            .Setup(x => x.GetAll())
            .Returns(PackageRegistrations.AsQueryable())
            .Verifiable();

            var packageRepository              = new Mock <IEntityRepository <Package> >();
            var packageOwnerRequestService     = new Mock <IPackageOwnerRequestService>();
            var packageNamingConflictValidator = new PackageNamingConflictValidator(
                packageRegistrationRepository.Object,
                packageRepository.Object);
            var auditingService = new TestAuditingService();

            var packageService = new Mock <PackageService>(
                packageRegistrationRepository.Object,
                packageRepository.Object,
                packageOwnerRequestService.Object,
                packageNamingConflictValidator,
                auditingService);

            packageService.CallBase = true;

            return(packageService);
        }
示例#2
0
        private Mock <PackageService> SetupPackageService()
        {
            var packageRegistrationRepository = new Mock <IEntityRepository <PackageRegistration> >();

            packageRegistrationRepository
            .Setup(x => x.GetAll())
            .Returns(PackageRegistrations.AsQueryable())
            .Verifiable();

            var packageRepository              = new Mock <IEntityRepository <Package> >();
            var certificateRepository          = new Mock <IEntityRepository <Certificate> >();
            var packageNamingConflictValidator = new PackageNamingConflictValidator(
                packageRegistrationRepository.Object,
                packageRepository.Object);
            var auditingService = new TestAuditingService();

            var telemetryService = new Mock <ITelemetryService>();

            var securityPolicyService = new Mock <ISecurityPolicyService>();

            var packageService = new Mock <PackageService>(
                packageRegistrationRepository.Object,
                packageRepository.Object,
                certificateRepository.Object,
                packageNamingConflictValidator,
                auditingService,
                telemetryService.Object,
                securityPolicyService.Object);

            packageService.CallBase = true;

            return(packageService);
        }