public void ResolveDimensionsAndDuration_ResolvesDimensionsUsingFileOperationsWhenNecessaryAndFileOperationsAreEnabled(double dummySpecifiedWidth,
                                                                                                                               double dummySpecifiedHeight,
                                                                                                                               double dummySpecifiedDuration,
                                                                                                                               double dummyRetrievedWidth,
                                                                                                                               double dummyRetrievedHeight,
                                                                                                                               double dummyRetrievedDuration,
                                                                                                                               double expectedWidth,
                                                                                                                               double expectedHeight,
                                                                                                                               double expectedDuration,
                                                                                                                               double expectedAspectRatio)
        {
            // Arrange
            const string         dummyLocalAbsolutePath = "dummyLocalAbsolutePath";
            Mock <IVideoService> mockVideoService       = _mockRepository.Create <IVideoService>();

            mockVideoService.Setup(i => i.GetVideoDimensionsAndDuration(dummyLocalAbsolutePath)).Returns((dummyRetrievedWidth, dummyRetrievedHeight, dummyRetrievedDuration));
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory(mockVideoService.Object);

            // Act
            (double resultWidth, double resultHeight, double resultAspectRatio, double resultDuration) = testSubject.
                                                                                                         ResolveDimensionsAndDuration(dummyLocalAbsolutePath, dummySpecifiedWidth, dummySpecifiedHeight, dummySpecifiedDuration);

            // Assert
            _mockRepository.VerifyAll();
            Assert.Equal(expectedWidth, resultWidth);
            Assert.Equal(expectedHeight, resultHeight);
            Assert.Equal(expectedAspectRatio, resultAspectRatio);
            Assert.Equal(expectedDuration, resultDuration);
        }
        public void ResolveBlockName_ResolvesBlockName(string dummyBlockName, string expectedResult)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory();

            // Act
            string result = testSubject.ResolveBlockName(dummyBlockName);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public void ResolvePoster_GeneratesPoster(string dummyLocalAbsolutePath, string dummyPosterLocalAbsolutePath, string dummySrc, string expectedResult)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject      = CreateFlexiVideoBlockFactory();
            Mock <IVideoService>   mockVideoService = _mockRepository.Create <IVideoService>();

            mockVideoService.Setup(v => v.GeneratePoster(dummyLocalAbsolutePath, dummyPosterLocalAbsolutePath));

            // Act
            string result = testSubject.ResolvePoster(dummyLocalAbsolutePath, dummySrc, null, true);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public void ResolvePoster_ResolvesPosterWithoutGeneratingPosterIfPossible(string dummyPoster,
                                                                                  bool dummyGeneratePoster,
                                                                                  string dummyLocalAbsolutePath,
                                                                                  string expectedResult)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory();

            // Act
            string result = testSubject.ResolvePoster(dummyLocalAbsolutePath, null, dummyPoster, dummyGeneratePoster);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public void ResolveType_ResolvesType(string dummyFileName,
                                             string dummyType,
                                             ReadOnlyDictionary <string, string> dummyMimeTypes,
                                             string expectedResult)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory();

            // Act
            string result = testSubject.ResolveType(dummyFileName, dummyType, dummyMimeTypes);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public void ResolveDimensionsAndDuration_ResolvesDimensionsWithoutFileOperationsWhenPossibleOrIfFileOperationsAreDisabled(double dummySpecifiedWidth,
                                                                                                                                  double dummySpecifiedHeight,
                                                                                                                                  double dummySpecifiedDuration,
                                                                                                                                  string dummyLocalAbsolutePath,
                                                                                                                                  double expectedWidth,
                                                                                                                                  double expectedHeight,
                                                                                                                                  double expectedAspectRatio,
                                                                                                                                  double expectedDuration)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory();

            // Act
            (double resultWidth, double resultHeight, double resultAspectRatio, double resultDuration) = testSubject.ResolveDimensionsAndDuration(dummyLocalAbsolutePath, dummySpecifiedWidth, dummySpecifiedHeight, dummySpecifiedDuration);

            // Assert
            _mockRepository.VerifyAll();
            Assert.Equal(expectedWidth, resultWidth);
            Assert.Equal(expectedHeight, resultHeight);
            Assert.Equal(expectedAspectRatio, resultAspectRatio);
            Assert.Equal(expectedDuration, resultDuration);
        }
        public void ResolveEnableFileOperations_ReturnsTrueIfFileOperationsAreEnabled(bool dummyEnableFileOperations,
                                                                                      string dummyLocalMediaDirectory,
                                                                                      bool dummyGeneratePoster,
                                                                                      string dummyPoster,
                                                                                      double dummyWidth,
                                                                                      double dummyHeight,
                                                                                      double dummyDuration,
                                                                                      bool expectedResult)
        {
            // Arrange
            FlexiVideoBlockFactory testSubject = CreateFlexiVideoBlockFactory();

            // Act
            bool result = testSubject.ResolveEnableFileOperations(dummyEnableFileOperations,
                                                                  dummyLocalMediaDirectory,
                                                                  dummyGeneratePoster,
                                                                  dummyPoster,
                                                                  dummyWidth,
                                                                  dummyHeight,
                                                                  dummyDuration);

            // Assert
            Assert.Equal(expectedResult, result);
        }