Line | |
---|
1 | using System;
|
---|
2 | using System.Text;
|
---|
3 | using System.Collections.Generic;
|
---|
4 | using System.Linq;
|
---|
5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
6 | using HeuristicLab.Clients.Hive.Salve;
|
---|
7 | using HeuristicLab.Services.Hive.Common;
|
---|
8 | using HeuristicLab.Services.Hive.Common.ServiceContracts;
|
---|
9 | using HeuristicLab.Clients.Common;
|
---|
10 |
|
---|
11 | namespace HeuristicLab.Clients.Hive.Slave.Tests {
|
---|
12 | [TestClass]
|
---|
13 | public class SlaveTest {
|
---|
14 |
|
---|
15 | // Use ClassInitialize to run code before running the first test in the class
|
---|
16 | [ClassInitialize]
|
---|
17 | public static void MyClassInitialize(TestContext testContext) {
|
---|
18 | PluginLoader.pluginAssemblies.Any();
|
---|
19 | ServiceLocator.Instance = new MockServiceLocator();
|
---|
20 | }
|
---|
21 |
|
---|
22 | public List<List<MessageContainer>> CreateMsgs() {
|
---|
23 | List<List<MessageContainer>> allMsgs = new List<List<MessageContainer>>();
|
---|
24 | //get slave to fetch job
|
---|
25 | List<MessageContainer> msg = new List<MessageContainer>();
|
---|
26 | msg.Add(new MessageContainer(MessageContainer.MessageType.AquireJob));
|
---|
27 | allMsgs.Add(msg);
|
---|
28 |
|
---|
29 | //do nothing
|
---|
30 | msg = new List<MessageContainer>();
|
---|
31 | allMsgs.Add(msg);
|
---|
32 |
|
---|
33 | msg = new List<MessageContainer>();
|
---|
34 | msg.Add(new MessageContainer(MessageContainer.MessageType.ShutdownSlave));
|
---|
35 | allMsgs.Add(msg);
|
---|
36 | return allMsgs;
|
---|
37 | }
|
---|
38 |
|
---|
39 | [TestMethod]
|
---|
40 | public void TestMethod1() {
|
---|
41 | using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
|
---|
42 | ((MockHiveService)service.Obj).Messages = CreateMsgs();
|
---|
43 | }
|
---|
44 |
|
---|
45 | HeuristicLab.Clients.Hive.Salve.Core core = new Salve.Core();
|
---|
46 | core.Start();
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.