public void Correctly_executes_service_agents()
		{
			MockRepository mocks = new MockRepository();

			IApplicationSettings settings = mocks.CreateMock<IApplicationSettings>();
			ITypeActivator activator = mocks.CreateMock<ITypeActivator>();
			IServiceAgentFactory factory = mocks.CreateMock<IServiceAgentFactory>();
			IServiceAgent serviceAgent1 = mocks.CreateMock<IServiceAgent>();
			IServiceAgent serviceAgent2 = mocks.CreateMock<IServiceAgent>();
			IServiceAgent[] serviceAgents = new IServiceAgent[] { serviceAgent1, serviceAgent2 };

			IServiceAgentAggregator aggregator = new ServiceAgentAggregator(settings, activator);

			using (mocks.Record())
			{
				Expect.Call(settings.GetServiceAgentFactory()).Return("serviceAgentType");
				Expect.Call(activator.ActivateType<IServiceAgentFactory>("serviceAgentType")).Return(factory);
				Expect.Call(factory.GetServiceAgents()).Return(serviceAgents);

				Expect.Call(serviceAgent1.AgentName).Return("FirstAgent").Repeat.Any();
				serviceAgent1.Run();

				Expect.Call(serviceAgent2.AgentName).Return("SecondAgent").Repeat.Any();
				serviceAgent2.Run();
			}

			using (mocks.Playback())
			{
				aggregator.ExecuteServiceAgentCycle();
			}

			mocks.VerifyAll();
		}
 public DataExtractServiceProcessor()
 {
     LogWrapper.Log("Enter DataExtractServiceProcess .ctor", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Information);
     _dal          = new DataAccessImpl();
     _serviceProxy = new ExternalServiceAgent();
     LogWrapper.Log("Exit DataExtractServiceProcess .ctor", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Information);
 }
예제 #3
0
        public void Correctly_executes_service_agents()
        {
            MockRepository mocks = new MockRepository();

            IApplicationSettings settings      = mocks.CreateMock <IApplicationSettings>();
            ITypeActivator       activator     = mocks.CreateMock <ITypeActivator>();
            IServiceAgentFactory factory       = mocks.CreateMock <IServiceAgentFactory>();
            IServiceAgent        serviceAgent1 = mocks.CreateMock <IServiceAgent>();
            IServiceAgent        serviceAgent2 = mocks.CreateMock <IServiceAgent>();

            IServiceAgent[] serviceAgents = new IServiceAgent[] { serviceAgent1, serviceAgent2 };

            IServiceAgentAggregator aggregator = new ServiceAgentAggregator(settings, activator);

            using (mocks.Record())
            {
                Expect.Call(settings.GetServiceAgentFactory()).Return("serviceAgentType");
                Expect.Call(activator.ActivateType <IServiceAgentFactory>("serviceAgentType")).Return(factory);
                Expect.Call(factory.GetServiceAgents()).Return(serviceAgents);

                Expect.Call(serviceAgent1.AgentName).Return("FirstAgent").Repeat.Any();
                serviceAgent1.Run();

                Expect.Call(serviceAgent2.AgentName).Return("SecondAgent").Repeat.Any();
                serviceAgent2.Run();
            }

            using (mocks.Playback())
            {
                aggregator.ExecuteServiceAgentCycle();
            }

            mocks.VerifyAll();
        }
예제 #4
0
 public BaseViewModel()
 {
     _closePopupCommand = new DelegateCommand <object>(ClosePopup, CanClose);
     _dialog            = new DialogService();
     _dialog.Width      = 300;
     _dialog.Height     = 200;
     this._ServiceAgent = new ServiceAgent();
 }
예제 #5
0
 public BaseViewModel()
 {
     _closePopupCommand = new DelegateCommand<object>(ClosePopup, CanClose);
     _dialog = new DialogService();
     _dialog.Width = 300;
     _dialog.Height = 200;
     this._ServiceAgent = new ServiceAgent();
 }
 public SecureService(
     IConfiguration Configuration,
     IServerUrls ServerUrls,
     IServiceAgent ServiceAgent)
     : base(Configuration, ServiceAgent)
 {
     serverUrls = ServerUrls;
 }
        public void TestCase()
        {
            generator.ProxyBuilder.CreateInterfaceProxyTypeWithTarget(
                typeof(IPresentationHost), Type.EmptyTypes, typeof(PresentationHost), ProxyGenerationOptions.Default);

            IServiceAgent agent =
                (IServiceAgent)
                generator.CreateInterfaceProxyWithTarget <IServiceAgent>(new ServiceAgent(), new StandardInterceptor());

            agent.GetProxy <string>();
        }
예제 #8
0
        public MoviesViewModel([Import] IServiceAgent serviceAgent)
        {
            //_serviceAgent = !IsInDesignMode ? serviceAgent : new MockServiceAgent();
            _serviceAgent = serviceAgent;

            GetMovieCommand = new RelayCommand<SelectionChangedEventArgs>(GetMovie);
                
            GetMovieUrlsCommand = new RelayCommand(GetMovieUrls);
            NewMovieCommand = new RelayCommand(NewMovie, () => SelMovie == null);
            UpdMovieCommand = new RelayCommand(UpdMovie, () => SelMovie != null);
            DelMovieCommand = new RelayCommand(DelMovie, () => SelMovie != null);

            RefreshCommand = new RelayCommand(Refresh);
        }
예제 #9
0
        public MoviesViewModel([Import] IServiceAgent serviceAgent)
        {
            //_serviceAgent = !IsInDesignMode ? serviceAgent : new MockServiceAgent();
            _serviceAgent = serviceAgent;

            GetMovieCommand = new RelayCommand <SelectionChangedEventArgs>(GetMovie);

            GetMovieUrlsCommand = new RelayCommand(GetMovieUrls);
            NewMovieCommand     = new RelayCommand(NewMovie, () => SelMovie == null);
            UpdMovieCommand     = new RelayCommand(UpdMovie, () => SelMovie != null);
            DelMovieCommand     = new RelayCommand(DelMovie, () => SelMovie != null);

            RefreshCommand = new RelayCommand(Refresh);
        }
예제 #10
0
        /// <summary>
        /// Costruttore.
        /// </summary>
        public SportsViewModel(IServiceAgent srvAgn)
        {
            if (IsInDesignMode)
            {
                // TODO Fare injection con IDataService
                SportsData sd = new SportsData();
                listCalcio = new ObservableCollection <Calcio>(sd.ListCalcio);
                listBasket = new ObservableCollection <Basket>(sd.ListBasket);
                listTennis = new ObservableCollection <Tennis>(sd.ListTennis);
            }
            else
            {
                // RELAY COMMAND
                NavToPageCommand = new RelayCommand(IncontroSelectedCommand);

                // SERVICE AGENT
                this.serviceAgent = srvAgn;
                this.serviceAgent.GetSports((sports, err) =>
                {
                    if (err != null)
                    {
                        System.Diagnostics.Debug.WriteLine("[SPORTSVIEWMODEL] \r" + err.Message);
                    }
                    else if (sports != null)
                    {
                        // CALCIO
                        this.ListCalcio = new ObservableCollection <Calcio>(sports.Calcio);
                        RaisePropertyChanged(() => GroupedCalcio);

                        // TENNIS
                        this.listTennis = new ObservableCollection <Tennis>(sports.Tennis);
                        RaisePropertyChanged(() => GroupedTennis);

                        // BASKET
                        this.listBasket = new ObservableCollection <Basket>(sports.Basket);
                        RaisePropertyChanged(() => GroupedBasket);
                    }
                    // Nascondo la progress
                    IsProgressIndicatorVisible = false;
                }
                                            , Constants.URL_JSON);
            }
        }
예제 #11
0
    public static AgentControlTask Start(IApplicationContext C, IServiceAgent Agent)
    {
        var systemTask = task(() =>
        {
            try
            {
                Agent.Start();
            }
            catch (Exception e)
            {
                var message = AppMessage.Error(e);
                C.Notify(message);
                return(message);
            }

            return(inform("Complete"));
        });

        return(new AgentControlTask(C, Agent, systemTask));
    }
		public void Should_continue_with_next_agents_event_if_one_agent_fails()
		{
			ApplicationException exception = new ApplicationException("Test Exception");

			MockRepository mocks = new MockRepository();

			IApplicationSettings settings = mocks.CreateMock<IApplicationSettings>();
			ITypeActivator activator = mocks.CreateMock<ITypeActivator>();
			IServiceAgentFactory factory = mocks.CreateMock<IServiceAgentFactory>();

			IServiceAgent serviceAgent1 = mocks.CreateMock<IServiceAgent>();
			IServiceAgent serviceAgent2 = mocks.CreateMock<IServiceAgent>();

			IServiceAgent[] serviceAgents = new IServiceAgent[] { serviceAgent1, serviceAgent2 };


			IServiceAgentAggregator aggregator = new ServiceAgentAggregator(settings, activator);

			using (mocks.Record())
			{
				Expect.Call(settings.GetServiceAgentFactory()).Return("serviceAgentType");
				Expect.Call(activator.ActivateType<IServiceAgentFactory>("serviceAgentType")).Return(factory);
				Expect.Call(factory.GetServiceAgents()).Return(serviceAgents);

				Expect.Call(serviceAgent1.AgentName).Return("FirstAgent").Repeat.Any();
				serviceAgent1.Run();
				LastCall.On(serviceAgent1).Throw(exception);

				Expect.Call(serviceAgent2.AgentName).Return("SecondAgent").Repeat.Any();
				serviceAgent2.Run();
			}

			using (mocks.Playback())
			{
				aggregator.ExecuteServiceAgentCycle();
			}

			mocks.VerifyAll();
		}
예제 #13
0
        public void Should_continue_with_next_agents_event_if_one_agent_fails()
        {
            ApplicationException exception = new ApplicationException("Test Exception");

            MockRepository mocks = new MockRepository();

            IApplicationSettings settings  = mocks.CreateMock <IApplicationSettings>();
            ITypeActivator       activator = mocks.CreateMock <ITypeActivator>();
            IServiceAgentFactory factory   = mocks.CreateMock <IServiceAgentFactory>();

            IServiceAgent serviceAgent1 = mocks.CreateMock <IServiceAgent>();
            IServiceAgent serviceAgent2 = mocks.CreateMock <IServiceAgent>();

            IServiceAgent[] serviceAgents = new IServiceAgent[] { serviceAgent1, serviceAgent2 };


            IServiceAgentAggregator aggregator = new ServiceAgentAggregator(settings, activator);

            using (mocks.Record())
            {
                Expect.Call(settings.GetServiceAgentFactory()).Return("serviceAgentType");
                Expect.Call(activator.ActivateType <IServiceAgentFactory>("serviceAgentType")).Return(factory);
                Expect.Call(factory.GetServiceAgents()).Return(serviceAgents);

                Expect.Call(serviceAgent1.AgentName).Return("FirstAgent").Repeat.Any();
                serviceAgent1.Run();
                LastCall.On(serviceAgent1).Throw(exception);

                Expect.Call(serviceAgent2.AgentName).Return("SecondAgent").Repeat.Any();
                serviceAgent2.Run();
            }

            using (mocks.Playback())
            {
                aggregator.ExecuteServiceAgentCycle();
            }

            mocks.VerifyAll();
        }
예제 #14
0
 public PatientController()
 {
     objPatientRepository = new ServiceAgent();
 }
 public SupplierController(IServiceAgent serviceAgent, ITransactionIndexerServiceAgent txAgent, IBusinessLogicLayer businessLayer)
 {
     _businessLogicLayer = businessLayer;
     _service            = serviceAgent;
     _txAgent            = txAgent;
 }
예제 #16
0
 /// <summary>
 /// Determines the identiy of an agent
 /// </summary>
 /// <param name="agent">The agent</param>
 public static AgentIdentity Identity(this IServiceAgent agent)
 => (agent.ServerId, agent.AgentId);
예제 #17
0
 // TODO: ctor that accepts IXxxServiceAgent
 public GaeldsposterViewModel(IServiceAgent serviceAgent)
 {
     this.serviceAgent = serviceAgent;
 }
예제 #18
0
 // TODO: ctor that accepts IXxxServiceAgent
 public KreditorSkylderListViewModel(IServiceAgent serviceAgent)
 {
     this.serviceAgent = serviceAgent;
 }
 public CounterService(
     IConfiguration Configuration, IServiceAgent ServiceAgent)
     : base(Configuration, ServiceAgent)
 {
 }
예제 #20
0
 public PeopleViewModel(IServiceAgent serviceAgent)
 {
     this.Birthdate     = DateTime.Now;
     this._serviceAgent = serviceAgent;
 }
예제 #21
0
 public OrderController(IServiceAgent serviceAgent, ITransactionIndexerServiceAgent txAgent)
 {
     _service = serviceAgent;
     _txAgent = txAgent;
 }
예제 #22
0
파일: AgentContext.cs 프로젝트: 0xCM/arrows
 public void Register(IServiceAgent agent)
 {
     Agents.TryAdd(agent.Identity(), agent);
 }
예제 #23
0
 public ProductsViewModel(IServiceAgent serviceAgent)
 {
     this._serviceAgent = serviceAgent;
 }
예제 #24
0
 public HomeController(IServiceAgent serviceAgent)
 {
     _serviceAgent = serviceAgent;
 }
예제 #25
0
 public AgentController(IServiceAgent serviceAgent, IServiceSeance serviceSeance, IMapper mapper)
 {
     this.serviceSeance = serviceSeance;
     this.mapper        = mapper;
     this.serviceAgent  = serviceAgent;
 }
예제 #26
0
 public MyPresenter(IServiceAgent services)
 {
예제 #27
0
 public ExceuteSA(IServiceAgent <CommonServiceAgent> serviceAgent)
 {
     _serviceAgent = serviceAgent;
 }
예제 #28
0
 public AuthController(IMapper mapper, IServiceAgent serviceAgent, IServiceAuthentification serviceAuthentification)
 {
     this.serviceAuthentification = serviceAuthentification;
     this.serviceAgent            = serviceAgent;
     this.mapper = mapper;
 }
예제 #29
0
 public CustomersViewModel(IServiceAgent serviceAgent)
 {
     this._serviceAgent = serviceAgent;
 }
예제 #30
0
 public GuestBookController(IServiceAgent agent)
 {
     this.agent = agent;
 }
예제 #31
0
 public AgentControlTask(IApplicationContext C, IServiceAgent ControlledAgent, Task <IAppMessage> SystemTask)
     : base(C)
 {
     this.ControlledAgent = ControlledAgent;
     this.SystemTask      = SystemTask;
 }
 public BaseService(IConfiguration Configuration, IServiceAgent ServiceAgent)
 {
     configuration = Configuration;
     agent         = ServiceAgent;
 }
 public RedirectController(IServiceAgent serviceAgent)
 {
     _serviceAgent = serviceAgent;
 }// GET: /<controller>/
예제 #34
0
 IServiceAgent _sa;     // custom made service agent for accessing some other web service
 public Foo(IExceptionManager em, IDatabase db, IServiceAgent _sa)
 {
     _em = em;
     _db = db;
     _sa = sa;
 }