public void TestConstructorSetsPropertiesCorrectly()
        {
            XboxProcessDefinition process = new XboxProcessDefinition(OperatingSystem, ProcessId, ImageFileName);

            Assert.AreEqual(OperatingSystem, process.OperatingSystem, "The OperatingSystem property was not set correctly.");
            Assert.AreEqual(ProcessId, process.ProcessId, "The ProcessId property was not set correctly.");
            Assert.AreEqual(ImageFileName, process.ImageFileName, "The ImageFileName property was not set correctly.");
        }
Esempio n. 2
0
        public void TestGetRunningProcessesCallsXboxXdkGetRunningProcesses()
        {
            bool isGetRunningProcessesCalled  = false;
            bool correctIpAddressPassed       = false;
            bool correctOperatingSystemPassed = false;

            var xboxProcesses = new XboxProcessDefinition[]
            {
                new XboxProcessDefinition(XboxOperatingSystem.Title, 0, "file0.exe"),
                new XboxProcessDefinition(XboxOperatingSystem.Title, 1, "file1.exe"),
                new XboxProcessDefinition(XboxOperatingSystem.Title, 2, "Home.exe"),
                new XboxProcessDefinition(XboxOperatingSystem.Title, 3, "file2.exe")
            };

            this.fakeXboxXdk.GetRunningProcessesFunc = (ipAddress, operatingSystem) =>
            {
                correctIpAddressPassed       = ipAddress == XboxConsoleAdapterTests.ConsoleAddress;
                correctOperatingSystemPassed = operatingSystem == XboxOperatingSystem.Title;
                isGetRunningProcessesCalled  = true;
                return(new XboxProcessDefinition[]
                {
                    xboxProcesses[0],
                    xboxProcesses[1],
                    xboxProcesses[2],
                    xboxProcesses[3]
                });
            };

            var processes = this.adapter.GetRunningProcesses(ConsoleAddress, XboxOperatingSystem.Title);

            Assert.IsTrue(isGetRunningProcessesCalled, "The adapter's GetRunningProcesses(XboxOperatingSystem) method must call the XboxXdk's GetRunningProcesses(..) method.");
            Assert.IsTrue(correctIpAddressPassed, "The adapter passed wrong IP Address to the XboxXdk's GetRunningProcesses(..) method.");
            Assert.IsTrue(correctOperatingSystemPassed, "The adapter passed wrong Operating System to the XboxXdk's GetRunningProcesses(..) method.");
            Assert.IsTrue(processes.SequenceEqual(xboxProcesses), "The adapter didn't return correct enumeration of processes.");

            this.VerifyThrows <ArgumentNullException>(() => this.adapter.GetRunningProcesses(null, XboxOperatingSystem.Title));
        }
Esempio n. 3
0
        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 TestConstructorSetsImageFileNamePropertyToEmptyWhenParameterIsNull()
        {
            XboxProcessDefinition process = new XboxProcessDefinition(OperatingSystem, ProcessId, null);

            Assert.AreEqual(string.Empty, process.ImageFileName, "The constructor did not set the ImageFileName to string.Empty as expected.");
        }