Пример #1
0
        public void ProcessRemoveMediaServicesAccountTest()
        {
            // Setup
            Mock <IMediaServicesClient> clientMock = new Mock <IMediaServicesClient>();

            const string expectedName = "testacc";

            clientMock.Setup(f => f.DeleteAzureMediaServiceAccountAsync(expectedName)).Returns(
                Task.Factory.StartNew(() => new OperationResponse {
                StatusCode = HttpStatusCode.NoContent
            }));

            // Test
            RemoveAzureMediaServiceCommand command = new RemoveAzureMediaServiceCommand
            {
                CommandRuntime      = new MockCommandRuntime(),
                Name                = expectedName,
                MediaServicesClient = clientMock.Object,
            };

            command.ExecuteCmdlet();
            Assert.AreEqual(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count);
            bool response = (bool)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();

            Assert.IsTrue(response);
        }
Пример #2
0
        public void ProcessRemoveMediaServicesAccountTest()
        {
            // Setup
            var clientMock = new Mock <IMediaServicesClient>();

            string expectedName = "testacc";

            clientMock.Setup(f => f.DeleteAzureMediaServiceAccountAsync(expectedName)).Returns(Task.Factory.StartNew(() => { return(true); }));

            // Test
            var command = new RemoveAzureMediaServiceCommand
            {
                CommandRuntime      = new MockCommandRuntime(),
                Name                = expectedName,
                MediaServicesClient = clientMock.Object,
            };

            command.ExecuteCmdlet();
            Assert.AreEqual(1, ((MockCommandRuntime)command.CommandRuntime).OutputPipeline.Count);
            var deleted = (bool)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();

            Assert.IsTrue(deleted);
        }