public void GetAllCollections() { int countOfExpectedCollections = 0; GetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon <GetAzureRemoteAppCollection>(); // Setup the environment for testing this cmdlet countOfExpectedCollections = MockObject.SetUpDefaultRemoteAppCollection(remoteAppManagementClientMock, collectionName); mockCmdlet.ResetPipelines(); Log("Calling Get-AzureRemoteAppCollection which should have {0} collections.", countOfExpectedCollections); 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 ) ); } List <Collection> collections = MockObject.ConvertList <Collection>(mockCmdlet.runTime().OutputPipeline); Assert.NotNull(collections); Assert.True(collections.Count == countOfExpectedCollections, String.Format("The expected number of collections returned {0} does not match the actual {1}.", countOfExpectedCollections, collections.Count ) ); Assert.True(MockObject.HasExpectedResults <Collection>(collections, MockObject.ContainsExpectedCollection), "The actual result does not match the expected." ); Log("The test for Get-AzureRemoteAppCollection with {0} collections completed successfully", countOfExpectedCollections); }