public async Task TestDeployPushAsync() { ShimXboxConsoleAdapterBase.AllInstances.DeployPushAsyncStringStringBooleanIProgressOfXboxDeploymentMetricIProgressOfXboxDeploymentErrorIProgressOfXboxDeploymentExtraFile = (adapter, systemIpAddress, deployPath, removeExtraFiles, progressMetric, progressError, progressExtraFile) => { return(Task.FromResult(new XboxPackageDefinition(PackageFullName, Aumids))); }; ShimXboxConsoleAdapterBase.AllInstances.DeployPushAsyncStringStringBooleanCancellationTokenIProgressOfXboxDeploymentMetricIProgressOfXboxDeploymentErrorIProgressOfXboxDeploymentExtraFile = (adapter, systemIpAddress, deployPath, removeExtraFiles, cancellationToken, progressMetric, progressError, progressExtraFile) => { return(Task.FromResult(new XboxPackageDefinition(PackageFullName, Aumids))); }; XboxPackage package = await this.console.DeployPushAsync(@"C:\", false).WithTimeout(TimeSpan.FromSeconds(30)); Assert.IsNotNull(package, "DeployPushAsync returned a null value when adapter return a valid value"); Assert.AreEqual(PackageFullName, package.FullName, "Package FullName did not match the expected name of the value returned by the adapter"); package = await this.console.DeployPushAsync(@"C:\", false, null, null, null).WithTimeout(TimeSpan.FromSeconds(30)); Assert.IsNotNull(package, "DeployPushAsync returned a null value when adapter return a valid value"); Assert.AreEqual(PackageFullName, package.FullName, "Package FullName did not match the expected name of the value returned by the adapter"); package = await this.console.DeployPushAsync(@"C:\", false, CancellationToken.None).WithTimeout(TimeSpan.FromSeconds(30)); Assert.IsNotNull(package, "DeployPushAsync returned a null value when adapter return a valid value"); Assert.AreEqual(PackageFullName, package.FullName, "Package FullName did not match the expected name of the value returned by the adapter"); package = await this.console.DeployPushAsync(@"C:\", false, CancellationToken.None, null, null, null).WithTimeout(TimeSpan.FromSeconds(30)); Assert.IsNotNull(package, "DeployPushAsync returned a null value when adapter return a valid value"); Assert.AreEqual(PackageFullName, package.FullName, "Package FullName did not match the expected name of the value returned by the adapter"); }
public void TestXboxPackageThrowsArgumentNullExceptionWithNullConsole() { #pragma warning disable 168 XboxPackage notUsed = new XboxPackage(this.packageDefinition, null); Assert.IsNotNull(notUsed, "XboxPackage constructor did not throw an ArgumentNullException as expected."); #pragma warning restore 168 }
public void TestUnregisterCallsAdapterUnregisterPackage() { bool isCorrectMethodCalled = false; ShimXboxConsoleAdapterBase.AllInstances.UnregisterPackageStringString = (adapter, systemIpAddress, packageFullName) => { isCorrectMethodCalled = true; }; XboxPackage package = new XboxPackage(new XboxPackageDefinition(PackageFullName, Aumids, true), this.xboxConsole); package.Unregister(); Assert.IsTrue(isCorrectMethodCalled, "The Unregister() method didn't call the adapter's UninstallPackage(systemIpAddress, packageFullName)."); }
public void TestInitialize() { this.shimsContext = ShimsContext.Create(); this.packageDefinition = new XboxPackageDefinition(PackageFullName, PackageFamilyName, Aumids); ShimXboxConsole.ConstructorIPAddress = (console, address) => { var myShim = new ShimXboxConsole(console) { AdapterGet = () => new StubXboxConsoleAdapterBase(null), SystemIpAddressGet = () => IPAddress.Parse(XboxPackageTests.ConsoleAddress), XboxGamepadsGet = () => new List <GamesTest.Xbox.Input.XboxGamepad>() }; }; ShimXboxConsoleAdapterBase.ConstructorXboxXdkBase = (adapter, xboxXdk) => { }; this.xboxConsole = new XboxConsole((IPAddress)null); this.xboxPackage = new XboxPackage(this.packageDefinition, this.xboxConsole); }