public void SetUp()
        {
            this.restConfigurations = new List <IRestConfiguration>();
            this.mockWrapperFactory = A.Fake <IWrapperFactory>();
            this.mockNetworkFactory = A.Fake <INetworkFactory>();

            this.configuration1 = A.Fake <IRestConfiguration>();
            A.CallTo(() => this.configuration1.BaseUrl).Returns("url1");
            A.CallTo(() => this.configuration1.UserName).Returns("user1");
            A.CallTo(() => this.configuration1.Password).Returns("password1");
            A.CallTo(() => this.configuration1.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration1.Name).Returns("conf1");
            restConfigurations.Add(this.configuration1);


            this.configuration2 = A.Fake <IRestConfiguration>();
            A.CallTo(() => this.configuration2.BaseUrl).Returns("url2");
            A.CallTo(() => this.configuration2.UserName).Returns("user2");
            A.CallTo(() => this.configuration2.Password).Returns("password2");
            A.CallTo(() => this.configuration2.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration2.Name).Returns("conf2");
            restConfigurations.Add(this.configuration2);

            this.mockHttpClientHandler = A.Fake <IHttpClient>();
            this.mockRestConsumer      = A.Fake <IRestConsumer>();

            A.CallTo(() => this.mockWrapperFactory.CreateHttpClientHandler(this.configuration1.UserName, this.configuration1.Password)).Returns(mockHttpClientHandler);
            A.CallTo(() => this.mockNetworkFactory.CreateRestConsumer(A <IUri> .Ignored, mockHttpClientHandler, mockWrapperFactory)).Returns(mockRestConsumer);

            this.testee = new RestFactory(this.restConfigurations, this.mockWrapperFactory, mockNetworkFactory);
        }
Exemplo n.º 2
0
 public DialogueLogic(IConditionRepository conditionRepository, IMonitor logger, IWrapperFactory factory)
 {
     _factory             = factory;
     _conditionRepository = conditionRepository;
     _logger      = logger;
     _gameWrapper = _factory.CreateInstance <IGameWrapper>();
 }
Exemplo n.º 3
0
        public GeneralCore(
            [Dependency]
            ITaskProviderClientFactory taskProviderClientFactory,
            [Dependency]
            IRepositoryClientFactory repositoryClientFactory,
            [Dependency]
            ISystemResources systemResources,
            [Dependency]
            IUnityContainer container,
            [Dependency]
            IExecutionStatus status,
            [Dependency]
            IWrapperFactory wrapperFactory)
        {
            Contract.Requires(taskProviderClientFactory != null);
            Contract.Requires(repositoryClientFactory != null);
            Contract.Requires(systemResources != null);
            Contract.Requires(container != null);
            Contract.Requires(wrapperFactory != null);

            this.taskProviderClientFactory = taskProviderClientFactory;
            this.repositoryClientFactory = repositoryClientFactory;
            this.systemResources = systemResources;
            this.container = container;
            this.status = status;
            this.wrapperFactory = wrapperFactory;
        }
        public void SetUp()
        {
            this.restConfigurations = new List<IRestConfiguration>();
            this.mockWrapperFactory = A.Fake<IWrapperFactory>();
            this.mockNetworkFactory = A.Fake<INetworkFactory>();

            this.configuration1 = A.Fake<IRestConfiguration>();
            A.CallTo(() => this.configuration1.BaseUrl).Returns("url1");
            A.CallTo(() => this.configuration1.UserName).Returns("user1");
            A.CallTo(() => this.configuration1.Password).Returns("password1");
            A.CallTo(() => this.configuration1.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration1.Name).Returns("conf1");
            restConfigurations.Add(this.configuration1);

            this.configuration2 = A.Fake<IRestConfiguration>();
            A.CallTo(() => this.configuration2.BaseUrl).Returns("url2");
            A.CallTo(() => this.configuration2.UserName).Returns("user2");
            A.CallTo(() => this.configuration2.Password).Returns("password2");
            A.CallTo(() => this.configuration2.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration2.Name).Returns("conf2");
            restConfigurations.Add(this.configuration2);

            this.mockHttpClientHandler = A.Fake<IHttpClient>();
            this.mockRestConsumer = A.Fake<IRestConsumer>();

            A.CallTo(() => this.mockWrapperFactory.CreateHttpClientHandler(this.configuration1.UserName, this.configuration1.Password)).Returns(mockHttpClientHandler);
            A.CallTo(() => this.mockNetworkFactory.CreateRestConsumer(A<IUri>.Ignored, mockHttpClientHandler, mockWrapperFactory)).Returns(mockRestConsumer);

            this.testee = new RestFactory(this.restConfigurations, this.mockWrapperFactory, mockNetworkFactory);
        }
        public TryToRetrieveDialoguePatch(IMonitor monitor, IHarmonyWrapper wrapper, IDialogueLogic dialogueLogic, IWrapperFactory factory) : base(monitor, wrapper)
        {
            HarmonyWrapper.Patch(
                AccessTools.Method(typeof(NPC), "tryToRetrieveDialogue"),
                new HarmonyMethod(typeof(TryToRetrieveDialoguePatch), "Prefix"),
                new HarmonyMethod(typeof(TryToRetrieveDialoguePatch), "Postfix"));

            _dialogueLogic  = dialogueLogic;
            _wrapperFactory = factory;
        }
Exemplo n.º 6
0
        public void SetUp()
        {
            var fakeTask = new Task <string>(() => FakeSerializedObjecString);

            this.fakeUri = A.Fake <IUri>();

            A.CallTo(() => fakeUri.ToUri()).Returns(new Uri(BaseUrl));

            this.fakeFactory = A.Fake <IWrapperFactory>();

            this.fakeHttpClient = A.Fake <IHttpClient>();
            A.CallTo(() => this.fakeHttpClient.GetStringAsync(A <IUri> .Ignored)).Returns(fakeTask);
            this.fakeHttpClient.GetStringAsync(fakeUri).Start();

            this.testee = new RestConsumer(fakeUri, this.fakeHttpClient, fakeFactory);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Registers all Wrappers supported by the Factory
        /// </summary>
        /// <param name="factory">The Factory Elements you want to register</param>
        /// <remarks>The wrapper must only be added if the Registry doesnt already contain it</remarks>
        public void Register(IWrapperFactory factory)
        {
            factory.LinkedRegistry = this;
            factory.LinkedProvider = this;
            Register(factory.KnownWrappers, factory.KnownWrappers);

            if (factory.GetType().GetInterface("SimPe.Interfaces.Plugin.IHelpFactory", false) == typeof(SimPe.Interfaces.Plugin.IHelpFactory))
            {
                Register((factory as SimPe.Interfaces.Plugin.IHelpFactory));
            }

            if (factory.GetType().GetInterface("SimPe.Interfaces.Plugin.ISettingsFactory", false) == typeof(SimPe.Interfaces.Plugin.ISettingsFactory))
            {
                Register((factory as SimPe.Interfaces.Plugin.ISettingsFactory));
            }

            if (factory.GetType().GetInterface("SimPe.Interfaces.Plugin.ICommandLineFactory", false) == typeof(SimPe.Interfaces.Plugin.ICommandLineFactory))
            {
                Register((factory as SimPe.Interfaces.Plugin.ICommandLineFactory));
            }

            AddUpdatablePlugin(factory);
        }
        public void SetUp()
        {
            var fakeTask = new Task<string>(() => FakeSerializedObjecString);

            this.fakeUri = A.Fake<IUri>();

            A.CallTo(() => fakeUri.ToUri()).Returns(new Uri(BaseUrl));

            this.fakeFactory = A.Fake<IWrapperFactory>();

            this.fakeHttpClient = A.Fake<IHttpClient>();
            A.CallTo(() => this.fakeHttpClient.GetStringAsync(A<IUri>.Ignored)).Returns(fakeTask);
            this.fakeHttpClient.GetStringAsync(fakeUri).Start();

            this.testee = new RestConsumer(fakeUri, this.fakeHttpClient, fakeFactory);
        }
 public RestFactory(IEnumerable <IRestConfiguration> configurations, IWrapperFactory wrapperFactory, INetworkFactory networkFactory)
 {
     this.configurations = configurations;
     this.wrapperFactory = wrapperFactory;
     this.networkFactory = networkFactory;
 }
 public IRestConsumer CreateRestConsumer(IUri baseUri, IHttpClient httpClientHandler, IWrapperFactory wrapperFactory)
 {
     return new RestConsumer(baseUri, httpClientHandler, wrapperFactory);
 }
        public ServerInvoker(IWrapperFactory factory)
        {
            Contract.Requires(factory != null);

            _factory = factory;
        }
 public void ComparisonRunTest()
 {
     _factory = new MockWrapperFactory();
     GetTestingConditions();
 }
 public RestFactory(IEnumerable<IRestConfiguration> configurations, IWrapperFactory wrapperFactory, INetworkFactory networkFactory)
 {
     this.configurations = configurations;
     this.wrapperFactory = wrapperFactory;
     this.networkFactory = networkFactory;
 }
 public IRestConsumer CreateRestConsumer(IUri baseUri, IHttpClient httpClientHandler, IWrapperFactory wrapperFactory)
 {
     return(new RestConsumer(baseUri, httpClientHandler, wrapperFactory));
 }
 public RestConsumer(IUri baseUrl, IHttpClient httpClient, IWrapperFactory wrapperFactory)
 {
     this.baseUrl        = baseUrl;
     this.httpClient     = httpClient;
     this.wrapperFactory = wrapperFactory;
 }