Example #1
0
 public Publisher(ILog log, IFileSystem fileSystem, IPackageFactory packageFactory, INuGetServer packageServer)
 {
     _log = log;
     _fileSystem = fileSystem;
     _packageFactory = packageFactory;
     _packageServer = packageServer;
 }
Example #2
0
 public void SetUp()
 {
     _mockedZipPackage = new Mock <IPackageMapper <IZipPackage> >();
     _mockedFileSystem = new Mock <IFileSystem>();
     _mockedDateTime   = new Mock <IDateTime>();
     _nuPackFactory    = new Plugins.NuPackPackageFactory.NuPackPackageFactory(_mockedFileSystem.Object, _mockedZipPackage.Object, _mockedDateTime.Object);
 }
Example #3
0
 public Package(IPackageFactory factory)
 {
     laptop = factory.CreateLaptop();
     phone  = factory.CreatePhone();
     tv     = factory.CreateTelevisor();
     GetInfo();
 }
Example #4
0
        public void Setup()
        {
            kernel = new MoqMockingKernel();
            kernel.Load(new ZappModule());

            factory = kernel.Get <IPackageFactory>();
        }
Example #5
0
 public void SetUp()
 {
     _mockedZipPackage = new Mock<IPackageMapper<IZipPackage>>();
     _mockedFileSystem = new Mock<IFileSystem>();
     _mockedDateTime = new Mock<IDateTime>();
     _nuPackFactory = new Plugins.NuPackPackageFactory.NuPackPackageFactory(_mockedFileSystem.Object, _mockedZipPackage.Object, _mockedDateTime.Object);
 }
 public void CreatePackageWithColor(string from)
 {
     if (from.ToLower() == "santa")
     {
         PackageFactory = new SantasHouse();
         Console.WriteLine($"I have a {PackageFactory.GetSize()} package for you in {PackageFactory.GetColor()}!");
     }
     else if (from.ToLower() == "grandma")
     {
         PackageFactory = new GrandmasHouse();
         Console.WriteLine($"I have a {PackageFactory.GetSize()} package for you in {PackageFactory.GetColor()}!");
     }
 }
        private static IEnumerable <TPackage> CreatePackagesFrom <TElement, TPackage>(
            IEnumerable <TElement> elements,
            IPackageFactory <TElement, TPackage> factory)
            where TElement : PackageElement
        {
            if (elements is null)
            {
                yield break;
            }

            foreach (var element in elements)
            {
                yield return(factory.Create(element));
            }
        }
        public PackageDownloader(IPackageFactory packageFactory, IHashProvider hashProvider)
        {
            if (packageFactory == null)
            {
                throw new ArgumentNullException("packageFactory");
            }

            if (hashProvider == null)
            {
                throw new ArgumentNullException("hashProvider");
            }

            _packageFactory = packageFactory;
            _hashProvider = hashProvider;
        }
Example #9
0
 public PackageCreator(IFileSystem fileSystem, IGuid guid, IPackageFactory packageFactory, IConfigSettings configSettings,
                       IRepository <Package> packageRepository, IPackageAuthenticator packageAuthenticator, IHashGetter hashGetter,
                       IPackageIdValidator packageIdValidator, IPackageUriValidator packageUriValidator,
                       ILatestVersionChecker latestVersionChecker, ILatestVersionUpdater <Package> latestVersionUpdater)
 {
     _fileSystem           = fileSystem;
     _latestVersionUpdater = latestVersionUpdater;
     _latestVersionChecker = latestVersionChecker;
     _packageIdValidator   = packageIdValidator;
     _guid                 = guid;
     _packageFactory       = packageFactory;
     _configSettings       = configSettings;
     _packageRepository    = packageRepository;
     _packageAuthenticator = packageAuthenticator;
     _hashGetter           = hashGetter;
     _packageUriValidator  = packageUriValidator;
 }
Example #10
0
 public PackageCreator(IFileSystem fileSystem, IGuid guid, IPackageFactory packageFactory, IConfigSettings configSettings,
     IRepository<Package> packageRepository, IPackageAuthenticator packageAuthenticator, IHashGetter hashGetter,
     IPackageIdValidator packageIdValidator, IPackageUriValidator packageUriValidator,
     ILatestVersionChecker latestVersionChecker, ILatestVersionUpdater<Package> latestVersionUpdater)
 {
     _fileSystem = fileSystem;
     _latestVersionUpdater = latestVersionUpdater;
     _latestVersionChecker = latestVersionChecker;
     _packageIdValidator = packageIdValidator;
     _guid = guid;
     _packageFactory = packageFactory;
     _configSettings = configSettings;
     _packageRepository = packageRepository;
     _packageAuthenticator = packageAuthenticator;
     _hashGetter = hashGetter;
     _packageUriValidator = packageUriValidator;
 }
Example #11
0
        public PackageDownloader(IHttpClient httpClient, IPackageFactory packageFactory, IHashProvider hashProvider) {
            if (httpClient == null) {
                throw new ArgumentNullException("httpClient");
            }

            if (packageFactory == null) {
                throw new ArgumentNullException("packageFactory");
            }

            if (hashProvider == null) {
                throw new ArgumentNullException("hashProvider");
            }

            _httpClient = httpClient;
            _packageFactory = packageFactory;
            _hashProvider = hashProvider;
            _httpClient.UserAgent = HttpUtility.CreateUserAgentString(DefaultUserAgentClient);
        }
Example #12
0
        /// <summary>
        /// Initializes a new <see cref="FilePackService"/>.
        /// </summary>
        /// <param name="logService">Service for logging.</param>
        /// <param name="syncService">Service for synchronizing package information.</param>
        /// <param name="configStore">Store for loading <see cref="ZappConfig"/>.</param>
        /// <param name="antFactory">Factory for creating <see cref="IAnt"/> instances.</param>
        /// <param name="antDirectoryFactory">Factory for creating <see cref="IAntDirectory"/> instances.</param>
        /// <param name="packageFactory">Factory for creating <see cref="IPackage"/> instances.</param>
        public FilePackService(
            ILog logService,
            ISyncService syncService,
            IConfigStore configStore,
            IAntFactory antFactory,
            IAntDirectoryFactory antDirectoryFactory,
            IPackageFactory packageFactory)
        {
            this.logService = logService;

            this.syncService = syncService;
            this.configStore = configStore;

            this.antFactory          = antFactory;
            this.antDirectoryFactory = antDirectoryFactory;

            this.packageFactory = packageFactory;

            packageRootDir = configStore?.Value?.Pack?
                             .GetActualRootDirectory();
        }
Example #13
0
        public void Setup()
        {
            serializer      = mockSerializer.Object;
            serializerCache = mockSerializerCache.Object;
            packageFactory  = mockPackageFactory.Object;

            package = new DataPackage <string>(new GuidPackageId(), obj);

            mockPackageFactory
            .Setup(m => m.Pack(It.IsAny <object>()))
            .Returns(package);

            mockPackageFactory
            .Setup(m => m.Unpack(It.IsAny <Package>()))
            .Returns(obj);

            mockSerializer
            .Setup(m => m.Descriptor)
            .Returns(dotNetSerializer.Descriptor);

            mockSerializer
            .Setup(m => m.Serialize(It.IsAny <Package>()))
            .Returns <Package>(p => dotNetSerializer.Serialize(p));

            mockSerializer
            .Setup(m => m.Serialize(It.IsAny <object>(), It.IsAny <int>()))
            .Returns <Package, int>((obj, offset) => dotNetSerializer.Serialize(obj, offset));

            mockSerializer
            .Setup(m => m.Deserialize <Package>(It.IsAny <byte[]>()))
            .Returns <byte[]>(d => dotNetSerializer.Deserialize <Package>(d));

            mockSerializer
            .Setup(m => m.Deserialize <Package>(It.IsAny <byte[]>(), It.IsAny <int>()))
            .Returns <byte[], int>((data, offset) => dotNetSerializer.Deserialize <Package>(data, offset));

            mockSerializerCache
            .Setup(m => m.DefaultSerializer)
            .Returns(serializer);
        }
Example #14
0
        public PackageDownloader(IHttpClient httpClient, IPackageFactory packageFactory, IHashProvider hashProvider)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException("httpClient");
            }

            if (packageFactory == null)
            {
                throw new ArgumentNullException("packageFactory");
            }

            if (hashProvider == null)
            {
                throw new ArgumentNullException("hashProvider");
            }

            _httpClient           = httpClient;
            _packageFactory       = packageFactory;
            _hashProvider         = hashProvider;
            _httpClient.UserAgent = HttpUtility.CreateUserAgentString(DefaultUserAgentClient);
        }
Example #15
0
 public PackageRepository(IArtefactProcessor artefactProcessor, IConfiguration configuration, IPackageFactory packageFactory)
 {
     this.artefactProcessor = artefactProcessor;
     this.configuration = configuration;
     this.packageFactory = packageFactory;
 }
Example #16
0
 public PackageRepository(IArtefactProcessor artefactProcessor, IConfiguration configuration, IPackageFactory packageFactory)
 {
     this.artefactProcessor = artefactProcessor;
     this.configuration     = configuration;
     this.packageFactory    = packageFactory;
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of <see cref="NetMQMessageFactory"/>
 /// </summary>
 /// <param name="serializerCache">A serializer that will convert data into a binary format for transmission</param>
 /// <param name="packageFactory">Wraps objects in a packages</param>
 public NetMQMessageFactory(ISerializerCache serializerCache, IPackageFactory packageFactory)
 {
     this.serializerCache = serializerCache ?? throw new ArgumentNullException(nameof(serializerCache));
     this.packageFactory  = packageFactory ?? throw new ArgumentNullException(nameof(packageFactory));
 }
Example #18
0
	/// <summary>
	/// Registers the net message factory.
	/// </summary>
	/// <param name="nID">N I.</param>
	/// <param name="factory">Factory.</param>
	public void 	RegisterPackageFactory(int nID, IPackageFactory factory)
	{
		if (!m_dFactory.ContainsKey(nID))
		{
#if OPEN_DEBUG_LOG
			Debug.Log("Register package factory " + nID);
#endif
			m_dFactory.Add(nID, factory);
		}
	}
 public FileSystemWatcher(IPackageFactory packageFactory, ILog log, IScheduler scheduler)
 {
     _packageFactory = packageFactory;
     _log            = log;
     _scheduler      = scheduler;
 }
Example #20
0
 public PackageRepository(IArtefactProcessor artefactProcessor, IPackageFactory packageFactory)
 {
     this.artefactProcessor = artefactProcessor;
     this.packageFactory = packageFactory;
 }
Example #21
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PackageScanner"/> class with the specified
 ///     <paramref name="platformManager"/> and <paramref name="packageFactory"/>.
 /// </summary>
 /// <param name="platformManager">The <see cref="IPlatformManager"/> instance for the application.</param>
 /// <param name="packageFactory">
 ///     The <see cref="IPackageFactory"/> used to create <see cref="IPackage"/> and <see cref="IPackageArchive"/> instances
 ///     from files and directories found by the scanner.
 /// </param>
 public PackageScanner(IPlatformManager platformManager, IPackageFactory packageFactory)
 {
     PlatformManager = platformManager;
     PackageFactory  = packageFactory;
 }
Example #22
0
 public DacpacMergeService(ILogger logger, IPackageFactory packageFactory, IModelFactory modelFactory)
 {
     _logger         = logger;
     _packageFactory = packageFactory;
     _modelFactory   = modelFactory;
 }