Exemplo n.º 1
0
 public ProductManagementService(IServiceProductsRepository serviceProductsRepository,
                                 IHashingProvider hashingProvider, IActivationLogRepoistory activationLogRepoistory)
 {
     _serviceProductsRepository = serviceProductsRepository;
     _hashingProvider           = hashingProvider;
     _activationLogRepoistory   = activationLogRepoistory;
 }
		public ProductManagementService(IServiceProductsRepository serviceProductsRepository,
			IHashingProvider hashingProvider, IActivationLogRepoistory activationLogRepoistory)
		{
			_serviceProductsRepository = serviceProductsRepository;
			_hashingProvider = hashingProvider;
			_activationLogRepoistory = activationLogRepoistory;
		}
            public void Before_each_test()
            {
                clientLicenseRepoistory = new ClientLicenseRepository(objectSerializationProvider, symmetricEncryptionProvider);
                clientLicenseService = new ClientLicenseService(clientLicenseRepoistory);
                serviceProductsRepository = new ServiceProductsRepository(new ScutexServiceEntities());
                symmetricEncryptionProvider = new SymmetricEncryptionProvider();
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                hashingProvider = new HashingProvider();
                objectSerializationProvider = new ObjectSerializationProvider();
                numberDataGenerator = new NumberDataGenerator();
                packingService = new PackingService(numberDataGenerator);
                commonRepository = new CommonRepository(new ScutexServiceEntities());
                clientRepository = new ClientRepository(new ScutexServiceEntities());
                keyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);
                masterService = new MasterService(commonRepository);
                activationLogRepository = new ActivationLogRepoistory(new ScutexServiceEntities());

                activationLogService = new ActivationLogService(activationLogRepository, hashingProvider);
                keyService = new KeyManagementService(clientRepository, licenseKeyService, activationLogService, hashingProvider, serviceProductsRepository);
                commonService = new CommonService();

                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                path = path.Replace("file:\\", "");

                var mockCommonService = new Mock<ICommonService>();
                mockCommonService.Setup(common => common.GetPath()).Returns(path + "\\Data\\Client\\");

                string masterServiceDataText;

                using (TextReader reader = new StreamReader(path + "\\Data\\MasterService.dat"))
                {
                    masterServiceDataText = reader.ReadToEnd().Trim();
                }

                masterServiceData = objectSerializationProvider.Deserialize<MasterServiceData>(masterServiceDataText);

                var mockCommonRepository = new Mock<ICommonRepository>();
                mockCommonRepository.Setup(repo => repo.GetMasterServiceData()).Returns(masterServiceData);

                keyPairService = new KeyPairService(mockCommonService.Object, mockCommonRepository.Object);
                controlService = new ControlService(symmetricEncryptionProvider, keyPairService, packingService, masterService, objectSerializationProvider, asymmetricEncryptionProvider);
                servicesRepository = new ServicesRepository(new ScutexEntities());
                serviceStatusProvider = new ServiceStatusProvider(symmetricEncryptionProvider, objectSerializationProvider, asymmetricEncryptionProvider);
                licenseActiviationProvider = new LicenseActiviationProvider(asymmetricEncryptionProvider, symmetricEncryptionProvider, objectSerializationProvider);
                servicesService = new ServicesService(servicesRepository, serviceStatusProvider, packingService, licenseActiviationProvider, null, null, null, null, null);
                licenseKeyService = new LicenseKeyService(keyGenerator, packingService, clientLicenseService);
                activationService = new ActivationService(controlService, keyService, keyPairService, objectSerializationProvider, asymmetricEncryptionProvider, null, null);

                string serviceData;

                using (TextReader reader = new StreamReader(path + "\\Data\\Service.dat"))
                {
                    serviceData = reader.ReadToEnd().Trim();
                }

                service = objectSerializationProvider.Deserialize<Service>(serviceData);
            }
Exemplo n.º 4
0
		public KeyManagementService(IClientRepository clientRepository, ILicenseKeyService licenseKeyService,
			IActivationLogService activationLogService, IHashingProvider hashingProvider, IServiceProductsRepository serviceProductsRepository)
		{
			_clientRepository = clientRepository;
			_licenseKeyService = licenseKeyService;
			_activationLogService = activationLogService;
			_hashingProvider = hashingProvider;
			_serviceProductsRepository = serviceProductsRepository;
		}
Exemplo n.º 5
0
 public KeyManagementService(IClientRepository clientRepository, ILicenseKeyService licenseKeyService,
                             IActivationLogService activationLogService, IHashingProvider hashingProvider, IServiceProductsRepository serviceProductsRepository)
 {
     _clientRepository          = clientRepository;
     _licenseKeyService         = licenseKeyService;
     _activationLogService      = activationLogService;
     _hashingProvider           = hashingProvider;
     _serviceProductsRepository = serviceProductsRepository;
 }
            public void Before_each_test()
            {
                clientLicenseRepoistory      = new ClientLicenseRepository(objectSerializationProvider, symmetricEncryptionProvider);
                clientLicenseService         = new ClientLicenseService(clientLicenseRepoistory);
                serviceProductsRepository    = new ServiceProductsRepository(new ScutexServiceEntities());
                symmetricEncryptionProvider  = new SymmetricEncryptionProvider();
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                hashingProvider             = new HashingProvider();
                objectSerializationProvider = new ObjectSerializationProvider();
                numberDataGenerator         = new NumberDataGenerator();
                packingService             = new PackingService(numberDataGenerator);
                commonRepository           = new CommonRepository(new ScutexServiceEntities());
                clientRepository           = new ClientRepository(new ScutexServiceEntities());
                keyGenerator               = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);
                masterService              = new MasterService(commonRepository);
                hardwareFingerprintService = new HardwareFingerprintService(new WmiDataProvider(), new HashingProvider());
                keyGeneratorLarge          = new Scutex.Generators.StaticKeyGeneratorLarge.KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider, hardwareFingerprintService);

                var mockActivationLogRepository = new Mock <IActivationLogRepoistory>();

                mockActivationLogRepository.Setup(log => log.SaveActivationLog(It.IsAny <Scutex.Model.ActivationLog>()));

                activationLogService = new ActivationLogService(mockActivationLogRepository.Object, hashingProvider);
                commonService        = new CommonService();

                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

                path = path.Replace("file:\\", "");

                var mockCommonService = new Mock <ICommonService>();

                mockCommonService.Setup(common => common.GetPath()).Returns(path + "\\Data\\Client\\");

                string masterServiceDataText;

                using (TextReader reader = new StreamReader(path + "\\Data\\MasterService.dat"))
                {
                    masterServiceDataText = reader.ReadToEnd().Trim();
                }

                masterServiceData = objectSerializationProvider.Deserialize <MasterServiceData>(masterServiceDataText);

                var mockCommonRepository = new Mock <ICommonRepository>();

                mockCommonRepository.Setup(repo => repo.GetMasterServiceData()).Returns(masterServiceData);

                masterService = new MasterService(mockCommonRepository.Object);

                keyPairService             = new KeyPairService(mockCommonService.Object, mockCommonRepository.Object);
                controlService             = new ControlService(symmetricEncryptionProvider, keyPairService, packingService, masterService, objectSerializationProvider, asymmetricEncryptionProvider);
                servicesRepository         = new ServicesRepository(new ScutexEntities());
                serviceStatusProvider      = new ServiceStatusProvider(symmetricEncryptionProvider, objectSerializationProvider, asymmetricEncryptionProvider);
                licenseActiviationProvider = new LicenseActiviationProvider(asymmetricEncryptionProvider, symmetricEncryptionProvider, objectSerializationProvider);
                servicesService            = new ServicesService(servicesRepository, serviceStatusProvider, packingService, licenseActiviationProvider, null, null, null, null, null);
                licenseKeyService          = new LicenseKeyService(keyGenerator, keyGeneratorLarge, packingService, clientLicenseService);
                keyService        = new KeyManagementService(clientRepository, licenseKeyService, activationLogService, hashingProvider, serviceProductsRepository);
                activationService = new ActivationService(controlService, keyService, keyPairService, objectSerializationProvider, asymmetricEncryptionProvider, activationLogService, masterService, commonService, null);

                string serviceData;

                using (TextReader reader = new StreamReader(path + "\\Data\\Service.dat"))
                {
                    serviceData = reader.ReadToEnd().Trim();
                }

                service = objectSerializationProvider.Deserialize <Service>(serviceData);
            }