示例#1
0
        public async void MediaServicesV3ServiceCanCreateTransformTest()
        {
            // Arrange
            var storage = new MediaService(storageAccounts: new List <StorageAccount>()
            {
                new StorageAccount()
                {
                    Id = DefaultStorageId
                }
            });
            var       tOutputs                          = new List <TransformOutput>();
            string    tNameNotExisting                  = "transformwhichdoesnotexist";
            var       amsV3TransformService             = Mock.Of <IMediaServicesV3TransformService>();
            Transform nullTransform                     = null;
            MediaServicesV3TransformBase amsV3Transform = new MediaServicesV3PresetTransform(EncoderNamedPreset.AdaptiveStreaming);

            // Arrange Mocks
            Mock.Get(AmsV3SdkWrapper)
            .Setup(x => x.TransformGetAsync(tNameNotExisting, It.IsAny <CancellationToken>()))
            .ReturnsAsync(nullTransform);

            Mock.Get(amsV3TransformService)
            .Setup(x => x.GetTransform(tNameNotExisting))
            .Returns(amsV3Transform);

            // Act
            var amsV3Services = new MediaServicesV3EncodeService(amsV3TransformService, AmsV3SdkWrapper, Log);

            // Assert
            var exception = await Record.ExceptionAsync(async() => await amsV3Services.CreateTransformIfNotExistByNameAsync(tNameNotExisting, DefaultOperationContext).ConfigureAwait(false)).ConfigureAwait(false);

            Xunit.Assert.Null(exception);
            Mock.Get(AmsV3SdkWrapper).Verify(x => x.TransformCreateOrUpdateAsync(tNameNotExisting, It.IsAny <IList <TransformOutput> >(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Once);
        }
示例#2
0
        public void MediaServicesV3PresetTransformCanCreatePresetTransformTest()
        {
            // Arrange
            string transformName = EncoderNamedPreset.AACGoodQualityAudio;
            var    transform     = new MediaServicesV3PresetTransform(transformName);

            // Act
            var output = transform.Output;

            // Assert
            Xunit.Assert.NotNull(output);
        }