public void CheckSerialization() { using (MemoryStream ms = new MemoryStream()) { var inMessage = testMessage.ToExpectedObject(); IpcStream ipcStream = new IpcStream(ms, new List <Type>()); ipcStream.WriteMessage(testMessage); ms.Seek(0, SeekOrigin.Begin); IpcMessage returnMessage = ipcStream.ReadMessage(); inMessage.ShouldEqual(returnMessage); } }
public void CheckMessageProcessing() { using (MemoryStream ms = new MemoryStream()) { // prep IpcMessage message = new IpcMessage() { Service = "IService", Method = "Sum", Parameters = new object[] { 3, 5 } }; IpcStream ipc = new IpcStream(ms, new List <Type>()); ipc.WriteMessage(message); long startpos = ms.Position; ms.Seek(0, SeekOrigin.Begin); // ---- Server s = new Server("testpipe"); s.RegisterService <IService>(new Calculator()); s.ProcessMessage(ipc, new Guid()); // post ms.Seek(startpos, SeekOrigin.Begin); IpcMessage returnMessage = ipc.ReadMessage(); var expectedMessage = new IpcMessage() { Return = 8 }.ToExpectedObject(); expectedMessage.ShouldEqual(returnMessage); } }