public void TestXboxProcessThrowsArgumentNullExceptionWithNullConsole() { #pragma warning disable 168 XboxProcess notUsed = new XboxProcess(this.processDefinition, null); Assert.IsNotNull(notUsed, "XboxProcess constructor did not throw an ArgumentNullException as expected."); #pragma warning restore 168 }
public void TestProcessRunPassesCorrectValues() { ShimXboxProcess.RunXboxConsoleStringStringXboxOperatingSystemActionOfString = (console, fileName, arguments, operatingSystem, outputReceivedCallback) => { Type processType = typeof(XboxProcess); CheckRunExecutableValueEquality(processType, console.SystemIpAddress.ToString(), fileName, arguments, operatingSystem, outputReceivedCallback); }; ShimXboxConsoleAdapterBase.AllInstances.RunExecutableStringStringStringXboxOperatingSystemActionOfString = (adapter, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback) => { Type adapterType = typeof(XboxConsoleAdapterBase); CheckRunExecutableValueEquality(adapterType, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback); }; ShimXboxXdkBase.AllInstances.RunExecutableStringStringStringXboxOperatingSystemActionOfString = (x, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback) => { Type xdkType = typeof(XboxXdkBase); CheckRunExecutableValueEquality(xdkType, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback); }; using (this.xboxConsole = new XboxConsole(this.processRunTestIPAddress)) { XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem, this.processRunTestAction); this.processRunTestAction = null; XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem); } }
/// <summary> /// Initializes access to various Xbox sub-systems. /// </summary> private void Initialize() { Memory = new XboxMemory(this); Kernel = new XboxKernel(this); System = new XboxSystem(this); Process = new XboxProcess(this); //DebugMonitor = new XboxDebugMonitor(this); FileSystem = new XboxFileSystem(this); //ConnectionId = Process.Call(Kernel.Exports.PhyGetLinkState, 0).ConnectionId; Logger?.Info("All Xbox subsystems have been successfully initialized"); }
public void TestProcessRunCallsAdapterRunExecutable() { bool isCorrectMethodCalled; ShimXboxConsoleAdapterBase.AllInstances.RunExecutableStringStringStringXboxOperatingSystemActionOfString = (adapter, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback) => { isCorrectMethodCalled = true; }; isCorrectMethodCalled = false; XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem); Assert.IsTrue(isCorrectMethodCalled, "The static XboxProcess.Run() method didn't call the adapter's RunExecutable( ... )."); isCorrectMethodCalled = false; XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem, this.processRunTestAction); Assert.IsTrue(isCorrectMethodCalled, "The static XboxProcess.Run() method didn't call the adapter's RunExecutable( ... )."); }
public void TestInitialize() { this.shimsContext = ShimsContext.Create(); this.processDefinition = new XboxProcessDefinition(XboxOperatingSystem.Title, 123, "process.exe"); ShimXboxConsole.ConstructorIPAddress = (console, address) => { var myShim = new ShimXboxConsole(console) { AdapterGet = () => new StubXboxConsoleAdapterBase(null), SystemIpAddressGet = () => IPAddress.Parse(XboxProcessTests.ConsoleAddress), XboxGamepadsGet = () => new List <Input.XboxGamepad>() }; }; ShimXboxConsoleAdapterBase.ConstructorXboxXdkBase = (adapter, xboxXdk) => { }; this.processRunTestAction = new Action <string>((str) => { }); this.xboxConsole = new XboxConsole((IPAddress)null); this.xboxProcess = new XboxProcess(this.processDefinition, this.xboxConsole); }
public void TestTextReceivedCallsAdapterStartDebugStopDebug() { bool isStartDebugCalled = false; bool isStopDebugCalled = false; bool isTextReceived0 = false; bool isTextReceived1 = false; bool isTextReceived2 = false; EventHandler <TextEventArgs> eventHandler = null; ShimXboxConsoleAdapterBase.AllInstances.StartDebugStringXboxOperatingSystemUInt32EventHandlerOfTextEventArgs = (adapter, systemIpAddress, operatingSystem, processId, handler) => { isStartDebugCalled = true; eventHandler = handler; }; ShimXboxConsoleAdapterBase.AllInstances.StopDebugStringXboxOperatingSystemUInt32 = (adapter, systemIpAddress, operatingSystem, processId) => { isStopDebugCalled = true; }; EventHandler <TextEventArgs> textReceived0 = (sender, args) => { isTextReceived0 = true; }; EventHandler <TextEventArgs> textReceived1 = (sender, args) => { isTextReceived1 = true; }; EventHandler <TextEventArgs> textReceived2 = (sender, args) => { isTextReceived2 = true; }; this.xboxProcess = new XboxProcess(this.processDefinition, this.xboxConsole); this.xboxProcess.TextReceived += textReceived0; this.xboxProcess.TextReceived += textReceived1; this.xboxProcess.TextReceived += textReceived2; Assert.IsTrue(isStartDebugCalled, "Adapter's StartDebug was not called."); Assert.IsFalse(isTextReceived0, "TextReceived event handler (0) should not be called."); Assert.IsFalse(isTextReceived1, "TextReceived event handler (1) should not be called."); Assert.IsFalse(isTextReceived2, "TextReceived event handler (2) should not be called."); Assert.IsFalse(isStopDebugCalled, "Adapter's StopDebug should not be called."); isStartDebugCalled = false; isStopDebugCalled = false; isTextReceived0 = false; isTextReceived1 = false; isTextReceived2 = false; // call a handler as well to test the event eventHandler(new object(), new TextEventArgs("Some source", "Some message")); Assert.IsFalse(isStartDebugCalled, "Adapter's StartDebug should not be called."); Assert.IsTrue(isTextReceived0, "TextReceived event handler (0) was not called."); Assert.IsTrue(isTextReceived1, "TextReceived event handler (1) was not called."); Assert.IsTrue(isTextReceived2, "TextReceived event handler (2) was not called."); Assert.IsFalse(isStopDebugCalled, "Adapter's StopDebug should not be called."); isStartDebugCalled = false; isStopDebugCalled = false; isTextReceived0 = false; isTextReceived1 = false; isTextReceived2 = false; this.xboxProcess.TextReceived -= textReceived0; this.xboxProcess.TextReceived -= textReceived1; this.xboxProcess.TextReceived -= textReceived2; Assert.IsFalse(isStartDebugCalled, "Adapter's StartDebug should not be called."); Assert.IsFalse(isTextReceived0, "TextReceived event handler (0) should not be called."); Assert.IsFalse(isTextReceived1, "TextReceived event handler (1) should not be called."); Assert.IsFalse(isTextReceived2, "TextReceived event handler (2) should not be called."); Assert.IsTrue(isStopDebugCalled, "Adapter's StopDebug was not called."); }
public void TestProcessRunAfterDispose() { this.xboxConsole = new XboxConsole(this.processRunTestIPAddress); this.xboxConsole.Dispose(); XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem); }
public void TestProcessRunThrowsOnIncorrectFilePath() { XboxProcess.Run(this.xboxConsole, string.Empty, ProcessRunTestArguments, ProcessRunTestOperatingSystem); }
public void TestProcessRunThrowsOnNullConsole() { XboxProcess.Run(null, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem); }