public void GetRemoteAppByName() { List <PublishedApplicationDetails> remoteApps = null; int countOfExpectedApps = 0; GetAzureRemoteAppProgram mockCmdlet = SetUpTestCommon <GetAzureRemoteAppProgram>(); // Required parameters for this test mockCmdlet.CollectionName = collectionName; mockCmdlet.Alias = "1340fc"; // Setup the environment for testing this cmdlet MockObject.SetUpDefaultRemoteAppCollectionByName(remoteAppManagementClientMock, mockCmdlet.CollectionName); countOfExpectedApps = MockObject.SetUpDefaultRemoteAppApplicationsByName(remoteAppManagementClientMock, mockCmdlet.CollectionName, mockCmdlet.Alias); mockCmdlet.ResetPipelines(); Log("Calling Get-AzureRemoteAppCollection which should have {0} collections.", countOfExpectedApps); mockCmdlet.ExecuteCmdlet(); if (mockCmdlet.runTime().ErrorStream.Count != 0) { Assert.True(false, String.Format("Get-AzureRemoteAppCollection returned the following error {0}.", mockCmdlet.runTime().ErrorStream[0].Exception.Message ) ); } remoteApps = MockObject.ConvertList <PublishedApplicationDetails>(mockCmdlet.runTime().OutputPipeline); Assert.NotNull(remoteApps); Assert.True(remoteApps.Count == countOfExpectedApps, String.Format("The expected number of collections returned {0} does not match the actual {1}.", countOfExpectedApps, remoteApps.Count ) ); Assert.True(MockObject.HasExpectedResults <PublishedApplicationDetails>(remoteApps, MockObject.ContainsExpectedApplication), "The actual result does not match the expected." ); Log("The test for Get-AzureRemoteAppCollection with {0} collections completed successfully", countOfExpectedApps); }