source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Tests/Mocks/MockServiceLocator.cs @ 6744

Last change on this file since 6744 was 6744, checked in by ascheibe, 9 years ago

#1233

  • renamed last couple of folders
  • fixed an installer bug
  • now with more license headers and less magic numbers
File size: 2.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Services.Hive;
24
25namespace HeuristicLab.Clients.Hive.Tests {
26  public class MockServiceLocator : IServiceLocator {
27    private string username;
28    public string Username {
29      get { return username; }
30      set { username = value; }
31    }
32
33    private string password;
34    public string Password {
35      get { return password; }
36      set { password = value; }
37    }
38
39    public HeuristicLab.Services.Hive.ServiceContracts.IHiveService GetService() {
40      HiveService service = new HeuristicLab.Services.Hive.HiveService();
41      return service;
42    }
43
44    public void CallHiveService(Action<HeuristicLab.Services.Hive.ServiceContracts.IHiveService> call) {
45      call(GetService());
46    }
47
48    public T CallHiveService<T>(Func<HeuristicLab.Services.Hive.ServiceContracts.IHiveService, T> call) {
49      return call(GetService());
50    }
51
52    #region IServiceLocator Members
53
54    public void CallHiveService(Action<IHiveService> call) {
55      // how to do this?
56    }
57
58    public T CallHiveService<T>(Func<IHiveService, T> call) {
59      // how to do this?
60      throw new NotImplementedException();
61    }
62
63    #endregion
64  }
65}
Note: See TracBrowser for help on using the repository browser.