public void GetSuggestedSaveFileNameBase_GivenVideoSettingsSpecifiesL2_SuggestedFileNameUsesL2()
        {
            ///////////
            // Setup //
            ///////////
            var obj = new RecordVideoWindow(null);

            // Setup videoSettings (the settings from the Bloom Player preview)
            obj.SetVideoSettingsFromPreview("{\"lang\":\"l2\"}");

            // Setup AllTitles
            var mockBook     = new Mock <Bloom.Book.Book>();
            var mockBookInfo = new Mock <Bloom.Book.BookInfo>();

            mockBookInfo.SetupGet(x => x.AllTitles).Returns("{ \"l1\": \"bookTitleL1\", \"l2\": \"bookTitleL2\"}");
            mockBook.Setup(book => book.BookInfo).Returns(mockBookInfo.Object);
            obj.SetBook(mockBook.Object);

            // Setup _pathToRealBook
            var invoker = new PrivateObject(obj);

            invoker.SetFieldOrProperty("_pathToRealBook", @"C:\MyCollection\bookTitleL1");

            ///////////////////////
            // System Under Test //
            ///////////////////////
            var result = obj.GetSuggestedSaveFileNameBase();

            //////////////////
            // Verification //
            //////////////////
            Assert.AreEqual("bookTitleL2", result);
        }
        public void VideoHasAudio_correctResult(string fileName, bool result)
        {
            var rvw  = new RecordVideoWindow(null);
            var path = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, fileName);

            Assert.That(rvw.VideoHasAudio(path), Is.EqualTo(result));
        }
        public void RecordVideoWindowGetBestYouTubeSize_PortraitBookOnLandscapeScreen_ReturnsStandardHeightAndProportionalWidth()
        {
            var result = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(1920, 1080), false);

            var expectedResult = new Resolution(480, 854);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void RecordVideoWindowGetBestYouTubeSize_LandscapeBookOnSlightlySmallerThanStandardSizeScreen_ReturnsOneStandardSizeDown(int maxWidth, int maxHeight, int expectedWidth, int expectedHeight)
        {
            var result = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(maxWidth, maxHeight), true);

            var expectedResult = new Resolution(expectedWidth, expectedHeight);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void RecordVideoWindowGetBestYouTubeSize_LandscapeBookOnBiggerThanFHDSizeScreen_ReturnsFHD(int maxWidth, int maxHeight)
        {
            var result = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(maxWidth, maxHeight), true);

            var expectedResult = new Resolution(1920, 1080);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void RecordVideoWindowGetBestYouTubeSize_LandscapeBookOnExactStandardSizeScreen_ReturnsThatSize(int maxWidth, int maxHeight)
        {
            var result = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(maxWidth, maxHeight), true);

            var expectedResult = new Resolution(maxWidth, maxHeight);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void RecordVideoWindowGetBestYouTubeSize_PortraitBookOnBiggerThanFHDPortraitScreen_ReturnsFHDSize(int maxWidth)
        {
            int maxHeight = maxWidth * 2;               // A 9x16 video will fit in this screen, with plenty of buffer
            var result    = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(maxWidth, maxHeight), false);

            var expectedResult = new Resolution(1080, 1920);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void RecordVideoWindowGetBestYouTubeSize_PortraitBookOnPortraitScreen_ReturnsStandardHeightAndProportionalWidth(int maxWidth, int expectedHeight)
        {
            int maxHeight = maxWidth * 2;               // A 9x16 video will fit in this screen, with plenty of buffer
            var result    = RecordVideoWindow.GetBestYouTubeResolution(new Resolution(maxWidth, maxHeight), false);

            int expectedWidth  = maxWidth;
            var expectedResult = new Resolution(expectedWidth, expectedHeight);

            Assert.AreEqual(expectedResult.ToString(), result.ToString());
        }
        public void GetSuggestedSaveFileNameBase_Simple()
        {
            var obj     = new RecordVideoWindow(null);
            var invoker = new PrivateObject(obj);

            invoker.SetFieldOrProperty("_pathToRealBook", @"C:\MyCollection\bookTitleL1");
            var result = obj.GetSuggestedSaveFileNameBase();

            Assert.AreEqual("bookTitleL1", result);
        }