diff --git a/src/GameServiceWarden.ClientAPI/Communicable/CommunicableType.cs b/src/GameServiceWarden.ClientAPI/Communicable/CommunicableType.cs index 81580b0..d311c80 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/CommunicableType.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/CommunicableType.cs @@ -6,7 +6,8 @@ namespace GameServiceWarden.ClientAPI { Disconnect, Connect, - Service, + View, + Delta, UnexpectedCommunication } } \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/ICommunicable.cs b/src/GameServiceWarden.ClientAPI/Communicable/ICommunicable.cs deleted file mode 100644 index f787379..0000000 --- a/src/GameServiceWarden.ClientAPI/Communicable/ICommunicable.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace GameServiceWarden.ClientAPI -{ - public interface ICommunicable - { - CommunicableType Type { get; } - } -} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Requests/ConnectRequest.cs b/src/GameServiceWarden.ClientAPI/Communicable/Requests/ConnectRequest.cs index c283fb2..02d3b08 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/Requests/ConnectRequest.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/Requests/ConnectRequest.cs @@ -1,13 +1,11 @@ -namespace GameServiceWarden.ClientAPI.Requests +namespace GameServiceWarden.ClientAPI.Communicable.Requests { - public struct ConnectRequest : ICommunicable + public struct ConnectRequest { public string requestedIdentifier; public string programName; public string programAuthor; public string versionNumber; public string details; - - public CommunicableType Type => CommunicableType.Connect; } } \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Requests/DeltaRequest.cs b/src/GameServiceWarden.ClientAPI/Communicable/Requests/DeltaRequest.cs new file mode 100644 index 0000000..9f45655 --- /dev/null +++ b/src/GameServiceWarden.ClientAPI/Communicable/Requests/DeltaRequest.cs @@ -0,0 +1,9 @@ +using GameServiceWarden.ClientAPI.Module; + +namespace GameServiceWarden.ClientAPI.Communicable.Requests +{ + public struct ServiceRequest + { + public ServiceManagerAction serviceManagerAction; + } +} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Requests/RequestHeader.cs b/src/GameServiceWarden.ClientAPI/Communicable/Requests/RequestHeader.cs index 16ac2ea..acf0bee 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/Requests/RequestHeader.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/Requests/RequestHeader.cs @@ -1,7 +1,7 @@ using System; using System.IO.Pipes; -namespace GameServiceWarden.ClientAPI.Requests +namespace GameServiceWarden.ClientAPI.Communicable.Requests { public static class RequestHeader { diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Requests/ServiceRequest.cs b/src/GameServiceWarden.ClientAPI/Communicable/Requests/ServiceRequest.cs deleted file mode 100644 index 219fb97..0000000 --- a/src/GameServiceWarden.ClientAPI/Communicable/Requests/ServiceRequest.cs +++ /dev/null @@ -1,11 +0,0 @@ -using GameServiceWarden.ClientAPI.Module; - -namespace GameServiceWarden.ClientAPI.Requests -{ - public struct ServiceRequest : ICommunicable - { - public ServiceManagerAction serviceManagerAction; - - public CommunicableType Type => CommunicableType.Service; - } -} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Requests/ViewRequest.cs b/src/GameServiceWarden.ClientAPI/Communicable/Requests/ViewRequest.cs new file mode 100644 index 0000000..df5d731 --- /dev/null +++ b/src/GameServiceWarden.ClientAPI/Communicable/Requests/ViewRequest.cs @@ -0,0 +1,7 @@ +namespace GameServiceWarden.ClientAPI.Communicable.Requests +{ + public struct ViewRequest + { + + } +} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ConnectResponse.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ConnectResponse.cs index 3ea19f2..e2ab3cf 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ConnectResponse.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ConnectResponse.cs @@ -1,14 +1,12 @@ using System.Security.Cryptography.X509Certificates; -namespace GameServiceWarden.ClientAPI.Responses +namespace GameServiceWarden.ClientAPI.Communicable.Responses { - public struct ConnectResponse : ICommunicable + public struct ConnectResponse { public string identifier; public bool nameTaken; public bool invalidName; public string errorMsg; - - public CommunicableType Type => CommunicableType.Connect; } } \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/DeltaResponse.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/DeltaResponse.cs new file mode 100644 index 0000000..0f6cd2f --- /dev/null +++ b/src/GameServiceWarden.ClientAPI/Communicable/Responses/DeltaResponse.cs @@ -0,0 +1,9 @@ +using GameServiceWarden.ClientAPI.Module; + +namespace GameServiceWarden.ClientAPI.Communicable.Responses +{ + public struct DeltaResponse + { + public ServiceManagerTotal gameServiceDelta; + } +} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ResponseHeader.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ResponseHeader.cs index b9dbc6e..c3f222b 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ResponseHeader.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ResponseHeader.cs @@ -1,6 +1,6 @@ using System; -namespace GameServiceWarden.ClientAPI.Responses +namespace GameServiceWarden.ClientAPI.Communicable.Responses { public static class ResponseHeader { diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ServiceManagerState.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ServiceManagerState.cs new file mode 100644 index 0000000..e69de29 diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ServiceResponse.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ServiceResponse.cs deleted file mode 100644 index d9cdf2d..0000000 --- a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ServiceResponse.cs +++ /dev/null @@ -1,11 +0,0 @@ -using GameServiceWarden.ClientAPI.Module; - -namespace GameServiceWarden.ClientAPI.Responses -{ - public struct ServiceResponse : ICommunicable - { - public ServiceManagerState gameServiceDelta; - - public CommunicableType Type => CommunicableType.Service; - } -} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/UnexpectedRequestResponse.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/UnexpectedRequestResponse.cs index 7f43eb2..391820f 100644 --- a/src/GameServiceWarden.ClientAPI/Communicable/Responses/UnexpectedRequestResponse.cs +++ b/src/GameServiceWarden.ClientAPI/Communicable/Responses/UnexpectedRequestResponse.cs @@ -1,10 +1,8 @@ -namespace GameServiceWarden.ClientAPI.Responses +namespace GameServiceWarden.ClientAPI.Communicable.Responses { - public struct UnexpectedRequestResponse : ICommunicable + public struct UnexpectedRequestResponse { public CommunicableType origin; public string message; - - public CommunicableType Type => CommunicableType.UnexpectedCommunication; } } \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Communicable/Responses/ViewResponse.cs b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ViewResponse.cs new file mode 100644 index 0000000..040967a --- /dev/null +++ b/src/GameServiceWarden.ClientAPI/Communicable/Responses/ViewResponse.cs @@ -0,0 +1,8 @@ +using GameServiceWarden.ClientAPI.Module; + +namespace GameServiceWarden.ClientAPI.Communicable.Responses +{ + public struct ViewResponse { + public ServiceManagerTotal state; + } +} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Module/ServiceManagerAction.cs b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerAction.cs index c516491..4581cdf 100644 --- a/src/GameServiceWarden.ClientAPI/Module/ServiceManagerAction.cs +++ b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerAction.cs @@ -11,7 +11,6 @@ namespace GameServiceWarden.ClientAPI.Module DeleteService, ExecuteCommand, SetServiceOption, - View } public string assemblyName; diff --git a/src/GameServiceWarden.ClientAPI/Module/ServiceManagerDelta.cs b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerDelta.cs new file mode 100644 index 0000000..f6990f0 --- /dev/null +++ b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerDelta.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace GameServiceWarden.ClientAPI.Module +{ + public struct ServiceManagerDelta + { + public bool subtract; + public string service; + public string running; + public string modules; + public byte[] logs; + public string optionName; + public string optionValue; + } +} \ No newline at end of file diff --git a/src/GameServiceWarden.ClientAPI/Module/ServiceManagerState.cs b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerTotal.cs similarity index 80% rename from src/GameServiceWarden.ClientAPI/Module/ServiceManagerState.cs rename to src/GameServiceWarden.ClientAPI/Module/ServiceManagerTotal.cs index 03b97bf..05078b5 100644 --- a/src/GameServiceWarden.ClientAPI/Module/ServiceManagerState.cs +++ b/src/GameServiceWarden.ClientAPI/Module/ServiceManagerTotal.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; namespace GameServiceWarden.ClientAPI.Module { - public struct ServiceManagerState + public struct ServiceManagerTotal { - public bool delta; - public bool subtract; public ICollection services; public ICollection running; public ICollection modules; diff --git a/src/GameServiceWarden.Core/Module/IServiceExecuter.cs b/src/GameServiceWarden.Core/Module/IServiceExecuter.cs index 3675a7b..ab5d936 100644 --- a/src/GameServiceWarden.Core/Module/IServiceExecuter.cs +++ b/src/GameServiceWarden.Core/Module/IServiceExecuter.cs @@ -5,5 +5,6 @@ namespace GameServiceWarden.Core.Module public interface IServiceManagerActionExecuter { void ExecuteAction(ServiceManagerAction action); + void ViewState(); } } \ No newline at end of file diff --git a/src/GameServiceWarden.Core/Module/IServiceManagerMonitor.cs b/src/GameServiceWarden.Core/Module/IServiceManagerMonitor.cs index 33664ab..60ed4e4 100644 --- a/src/GameServiceWarden.Core/Module/IServiceManagerMonitor.cs +++ b/src/GameServiceWarden.Core/Module/IServiceManagerMonitor.cs @@ -4,6 +4,7 @@ namespace GameServiceWarden.Core.Module { public interface IServiceManagerMonitor { - void Present(ServiceManagerState state); + void Present(ServiceManagerTotal state); + void Present(ServiceManagerDelta delta); } } \ No newline at end of file diff --git a/src/GameServiceWarden.Core/Module/ServiceManager.cs b/src/GameServiceWarden.Core/Module/ServiceManager.cs index 81107dc..86ab2ed 100644 --- a/src/GameServiceWarden.Core/Module/ServiceManager.cs +++ b/src/GameServiceWarden.Core/Module/ServiceManager.cs @@ -6,6 +6,7 @@ using GameServiceWarden.ClientAPI.Module; using GameServiceWarden.Core.Persistence; using GameServiceWarden.ModuleAPI; using GameServiceWarden.Core.Collection; +using System.Text; namespace GameServiceWarden.Core.Module { @@ -35,11 +36,9 @@ namespace GameServiceWarden.Core.Module data[ServiceDescriptor.ASSEMBLY_PROPERTY] = assemblyName; data[ServiceDescriptor.MODULE_PROPERTY] = moduleName; services.AddToPersistence(serviceName, data); - ServiceManagerState managerState = new ServiceManagerState(); - managerState.delta = true; + ServiceManagerDelta managerState = new ServiceManagerDelta(); managerState.subtract = false; - managerState.services = new List(); - managerState.services.Add(serviceName); + managerState.service = serviceName; managerMonitor.Present(managerState); } @@ -48,17 +47,15 @@ namespace GameServiceWarden.Core.Module if (!services.ContainsKey(serviceName)) throw new KeyNotFoundException($"Service under name \"{serviceName}\" not found."); if (running.ContainsKey(serviceName)) running[serviceName].Stop(); services.Delete(serviceName); - ServiceManagerState managerState = new ServiceManagerState(); - managerState.delta = true; + ServiceManagerDelta managerState = new ServiceManagerDelta(); managerState.subtract = true; - managerState.services = new List(); - managerState.services.Add(serviceName); + managerState.service = serviceName; managerMonitor.Present(managerState); } public IEnumerable GetModuleNames() { - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerTotal managerState = new ServiceManagerTotal(); managerState.modules = modules.Keys.ToImmutableArray(); managerMonitor.Present(managerState); return modules.Keys; @@ -66,14 +63,14 @@ namespace GameServiceWarden.Core.Module public IEnumerable GetServiceNames() { - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerTotal managerState = new ServiceManagerTotal(); managerState.services = services.Keys.ToImmutableArray(); managerMonitor.Present(managerState); return services.Keys; } public IEnumerable GetRunningServiceNames() { - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerTotal managerState = new ServiceManagerTotal(); managerState.running = running.Keys.ToImmutableArray(); managerMonitor.Present(managerState); return running.Keys; @@ -97,7 +94,7 @@ namespace GameServiceWarden.Core.Module } public IReadOnlyDictionary> GetOptions() { - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerTotal managerState = new ServiceManagerTotal(); Dictionary> serviceOptions = new Dictionary>(); foreach (string service in GetServiceNames()) { @@ -119,17 +116,14 @@ namespace GameServiceWarden.Core.Module IReadOnlyDictionary info = services[serviceName]; ServiceDescriptor service = descriptorCache.Use(serviceName, () => GenerateDescriptor(serviceName, info[ServiceDescriptor.ASSEMBLY_PROPERTY], info[ServiceDescriptor.MODULE_PROPERTY])); if (!service.GetConfigurableOptions().Contains(optionName)) throw new KeyNotFoundException($"Option \"{optionName}\" for service \"{serviceName}\" not found."); - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerDelta managerState = new ServiceManagerDelta(); if (service.SetConfigurableValue(optionName, value)) { - managerState.delta = true; - Dictionary> changedOption = new Dictionary>(); - Dictionary options = new Dictionary(); - options[optionName] = GetServiceOptionValue(serviceName, optionName); - changedOption[serviceName] = options; - managerState.serviceOptions = changedOption; + managerState.optionName = optionName; + managerState.optionValue = GetServiceOptionValue(serviceName, optionName); + managerMonitor.Present(managerState); + return true; } - managerMonitor.Present(managerState); - return managerState.delta; + return false; } public void StartService(string serviceName) @@ -168,7 +162,7 @@ namespace GameServiceWarden.Core.Module { logs.Add(service, running[service].GetLogBuffer()); } - ServiceManagerState managerState = new ServiceManagerState(); + ServiceManagerTotal managerState = new ServiceManagerTotal(); managerState.logs = logs; managerMonitor.Present(managerState); return logs; @@ -180,15 +174,13 @@ namespace GameServiceWarden.Core.Module private void OnServiceStateChange(object sender, ServiceState state) { ServiceDescriptor serviceInfo = (ServiceDescriptor)sender; - ServiceManagerState managerChange = new ServiceManagerState(); + ServiceManagerDelta managerChange = new ServiceManagerDelta(); switch (state) { case ServiceState.Running: if (running.TryAdd(serviceInfo.ServiceName, serviceInfo)) { - managerChange.delta = true; - managerChange.running = new List(); - managerChange.running.Add(serviceInfo.ServiceName); + managerChange.running = serviceInfo.ServiceName; } break; case ServiceState.Stopped: @@ -200,10 +192,8 @@ namespace GameServiceWarden.Core.Module removedInfo[ServiceDescriptor.ASSEMBLY_PROPERTY] = removed.GetAssemblyName(); removedInfo[ServiceDescriptor.MODULE_PROPERTY] = removed.GetModuleName(); services[serviceInfo.ServiceName] = removedInfo; - managerChange.delta = true; managerChange.subtract = true; - managerChange.running = new List(); - managerChange.running.Add(serviceInfo.ServiceName); + managerChange.running = serviceInfo.ServiceName; } break; } @@ -213,25 +203,15 @@ namespace GameServiceWarden.Core.Module void OnLogUpdated(object sender, string update) { ServiceDescriptor service = (ServiceDescriptor)sender; - ServiceManagerState state = new ServiceManagerState(); - state.delta = true; - Dictionary logUpdate = new Dictionary(); - logUpdate[service.ServiceName] = update; - managerMonitor.Present(state); + ServiceManagerDelta delta = new ServiceManagerDelta(); + delta.logs = Encoding.UTF8.GetBytes(update); + managerMonitor.Present(delta); } public void ExecuteAction(ServiceManagerAction action) { switch (action.action) { - case ServiceManagerAction.Type.View: - GetServiceNames(); - GetRunningServiceNames(); - GetModuleNames(); - GetLogBuffer(); - GetOptions(); - break; - case ServiceManagerAction.Type.CreateService: CreateService(action.serviceName, action.assemblyName, action.moduleName); break; @@ -254,5 +234,14 @@ namespace GameServiceWarden.Core.Module break; } } + + public void ViewState() + { + GetServiceNames(); + GetRunningServiceNames(); + GetModuleNames(); + GetLogBuffer(); + GetOptions(); + } } } \ No newline at end of file diff --git a/src/GameServiceWarden.Core/UI/IPCController.cs b/src/GameServiceWarden.Core/UI/IPCController.cs index e493501..a619488 100644 --- a/src/GameServiceWarden.Core/UI/IPCController.cs +++ b/src/GameServiceWarden.Core/UI/IPCController.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Text.Json; using GameServiceWarden.ClientAPI; -using GameServiceWarden.ClientAPI.Requests; +using GameServiceWarden.ClientAPI.Communicable.Requests; using GameServiceWarden.Core.Module; using GameServiceWarden.Core.Logging; @@ -26,9 +26,13 @@ namespace GameServiceWarden.Core.UI { switch (action.Item2) { - case CommunicableType.Service: - ServiceRequest request = JsonSerializer.Deserialize(action.Item3); - serviceExecutioner.ExecuteAction(request.serviceManagerAction); + case CommunicableType.Delta: + ServiceRequest delta = JsonSerializer.Deserialize(action.Item3); + serviceExecutioner.ExecuteAction(delta.serviceManagerAction); + break; + case CommunicableType.View: + ViewRequest view = JsonSerializer.Deserialize(action.Item3); + serviceExecutioner.ViewState(); break; } } diff --git a/src/GameServiceWarden.Core/UI/IPCMediator.cs b/src/GameServiceWarden.Core/UI/IPCMediator.cs index e7f0b85..49531d1 100644 --- a/src/GameServiceWarden.Core/UI/IPCMediator.cs +++ b/src/GameServiceWarden.Core/UI/IPCMediator.cs @@ -8,8 +8,8 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; using GameServiceWarden.ClientAPI; -using GameServiceWarden.ClientAPI.Requests; -using GameServiceWarden.ClientAPI.Responses; +using GameServiceWarden.ClientAPI.Communicable.Requests; +using GameServiceWarden.ClientAPI.Communicable.Responses; using GameServiceWarden.Core.Logging; namespace GameServiceWarden.Core.UI diff --git a/src/GameServiceWarden.Core/UI/IPCPresenter.cs b/src/GameServiceWarden.Core/UI/IPCPresenter.cs index 1d6079b..67ccc2d 100644 --- a/src/GameServiceWarden.Core/UI/IPCPresenter.cs +++ b/src/GameServiceWarden.Core/UI/IPCPresenter.cs @@ -15,9 +15,16 @@ namespace GameServiceWarden.Core.UI this.mediator = mediator; } - public void Present(ServiceManagerState state) + public void Present(ServiceManagerTotal state) { - Task replyTask = mediator.ReplyAll(CommunicableType.Service, JsonSerializer.SerializeToUtf8Bytes(state)); + Task replyTask = mediator.ReplyAll(CommunicableType.View, JsonSerializer.SerializeToUtf8Bytes(state)); + replyTask.Wait(); + } + + public void Present(ServiceManagerDelta delta) + { + Task replyTask = mediator.ReplyAll(CommunicableType.Delta, JsonSerializer.SerializeToUtf8Bytes(delta)); + replyTask.Wait(); } } } \ No newline at end of file diff --git a/tests/GameServiceWarden.Core.Tests/Modules/FakeServiceManagerMonitor.cs b/tests/GameServiceWarden.Core.Tests/Modules/FakeServiceManagerMonitor.cs index c983b7c..81a64f6 100644 --- a/tests/GameServiceWarden.Core.Tests/Modules/FakeServiceManagerMonitor.cs +++ b/tests/GameServiceWarden.Core.Tests/Modules/FakeServiceManagerMonitor.cs @@ -7,22 +7,33 @@ namespace GameServiceWarden.Core.Tests.Modules { public class FakeServiceManagerMonitor : IServiceManagerMonitor { - public List states = new List(); - public ServiceManagerState this[int i] + public List states = new List(); + public List deltas = new List(); + public ServiceManagerTotal this[int i] { get { return states[i]; } } - public void Present(ServiceManagerState state) + + public void Present(ServiceManagerTotal state) { states.Add(state); } - public ServiceManagerState GetLastState() + public void Present(ServiceManagerDelta delta) + { + deltas.Add(delta); + } + + public ServiceManagerTotal GetLastState() { return states[states.Count - 1]; } + + public ServiceManagerDelta GetLastDelta() { + return deltas[deltas.Count - 1]; + } } } \ No newline at end of file diff --git a/tests/GameServiceWarden.Core.Tests/Modules/ServiceManagerTest.cs b/tests/GameServiceWarden.Core.Tests/Modules/ServiceManagerTest.cs index 908fe2c..2dfd7ef 100644 --- a/tests/GameServiceWarden.Core.Tests/Modules/ServiceManagerTest.cs +++ b/tests/GameServiceWarden.Core.Tests/Modules/ServiceManagerTest.cs @@ -1,15 +1,10 @@ -using System; using System.Collections.Generic; using System.IO; -using System.IO.Pipes; -using System.Threading; -using System.Threading.Tasks; using GameServiceWarden.Core.Module; using GameServiceWarden.Core.Logging; using GameServiceWarden.ModuleAPI; using Xunit; using Xunit.Abstractions; -using System.Text; [assembly: CollectionBehavior(DisableTestParallelization = true)] namespace GameServiceWarden.Core.Tests.Modules @@ -39,7 +34,7 @@ namespace GameServiceWarden.Core.Tests.Modules //When serviceManager.CreateService(FAKE_SERVICE_NAME, ASSEMBLY_NAME, stubServiceModule.Name); //Then - Assert.Contains(FAKE_SERVICE_NAME, stubMonitor.GetLastState().services); + Assert.True(FAKE_SERVICE_NAME.Equals(stubMonitor.GetLastDelta().service)); } [Fact] @@ -60,9 +55,8 @@ namespace GameServiceWarden.Core.Tests.Modules serviceManager.CreateService(FAKE_SERVICE_NAME, ASSEMBLY_NAME, stubServiceModule.Name); serviceManager.DeleteService(FAKE_SERVICE_NAME); //Then - Assert.True(stubMonitor.GetLastState().delta); - Assert.True(stubMonitor.GetLastState().subtract); - Assert.Contains(FAKE_SERVICE_NAME, stubMonitor.GetLastState().services); + Assert.True(stubMonitor.GetLastDelta().subtract); + Assert.True(FAKE_SERVICE_NAME.Equals(stubMonitor.GetLastDelta().service)); } [Fact]