public void GetAllTemplates() { int countOfExpectedTemplates = 0; GetAzureRemoteAppTemplateImage mockCmdlet = SetUpTestCommon <GetAzureRemoteAppTemplateImage>(); // Setup the environment for testing this cmdlet countOfExpectedTemplates = MockObject.SetUpDefaultRemoteAppTemplates(remoteAppManagementClientMock, templateName, templateId); mockCmdlet.ResetPipelines(); Log("Calling Get-AzureRemoteAppTemplateImage which should have {0} templates", countOfExpectedTemplates); mockCmdlet.ExecuteCmdlet(); if (mockCmdlet.runTime().ErrorStream.Count != 0) { Assert.True(false, String.Format("Get-AzureRemoteAppTemplateImage returned the following error {0}", mockCmdlet.runTime().ErrorStream[0].Exception.Message ) ); } List <TemplateImage> templates = MockObject.ConvertList <TemplateImage>(mockCmdlet.runTime().OutputPipeline); Assert.NotNull(templates); Assert.True(templates.Count == countOfExpectedTemplates, String.Format("The expected number of templates returned {0} does not match the actual {1}", countOfExpectedTemplates, templates.Count ) ); Assert.True(MockObject.ContainsExpectedTemplate(MockObject.mockTemplates, templates), "The actual result does not match the expected" ); Log("The test for Get-AzureRemoteAppTemplateImage with {0} templates completed successfully", countOfExpectedTemplates); }