public void ProcessGetMediaServiceByNameShouldReturnOneMatchingEntry() { // Setup SimpleMediaServiceManagementAzureNamespace channel = new SimpleMediaServiceManagementAzureNamespace(); const string expectedName = "media1"; channel.GetMediaServicesThunk = ar => { return new MediaServiceAccounts(new List<MediaServiceAccount> { new MediaServiceAccount { Name = expectedName }, new MediaServiceAccount { Name = "media2" } }); }; // Test GetAzureMediaServicesCommand getAzureWebsiteCommand = new GetAzureMediaServicesCommand(channel) { ShareChannel = true, CommandRuntime = new MockCommandRuntime(), CurrentSubscription = new SubscriptionData { SubscriptionId = base.subscriptionId } }; getAzureWebsiteCommand.Name = expectedName; getAzureWebsiteCommand.ExecuteCmdlet(); Assert.AreEqual(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); var accounts = (IEnumerable<MediaServiceAccount>)((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.FirstOrDefault(); Assert.IsNotNull(accounts); Assert.AreEqual(expectedName,accounts.FirstOrDefault().Name); }
public void ProcessGetMediaServiceByNameShouldNotReturnEntriesForNoneMatchingName() { // Setup SimpleMediaServiceManagementAzureNamespace channel = new SimpleMediaServiceManagementAzureNamespace(); const string expectedName = "media1"; channel.GetMediaServicesThunk = ar => { return new MediaServiceAccounts(new List<MediaServiceAccount> { new MediaServiceAccount { Name = expectedName }, new MediaServiceAccount { Name = "media2" } }); }; // Test GetAzureMediaServicesCommand getAzureWebsiteCommand = new GetAzureMediaServicesCommand(channel) { ShareChannel = true, CommandRuntime = new MockCommandRuntime(), CurrentSubscription = new SubscriptionData { SubscriptionId = base.subscriptionId } }; getAzureWebsiteCommand.Name = Guid.NewGuid().ToString(); getAzureWebsiteCommand.ExecuteCmdlet(); Assert.AreEqual(0, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); }