public void GetCastSizeRowValues_ProjectHasTwoBooksByDifferentAuthorsWithNoSpeakingParts_AllCastSizesHaveThreeMalesForNarratorAndExtra()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.PHM, TestProject.TestBook.IIIJN);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption = NarratorsOption.NarrationByAuthor;
            testProject.DramatizationPreferences.SectionHeadDramatization         = ExtraBiblicalMaterialSpeakerOption.MaleActor;
            testProject.DramatizationPreferences.BookTitleAndChapterDramatization = ExtraBiblicalMaterialSpeakerOption.MaleActor;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(3, smallCast.Male);
            Assert.AreEqual(0, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(3, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(3, recommendedCast.Male);
            Assert.AreEqual(0, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(3, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(3, largeCast.Male);
            Assert.AreEqual(0, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(3, largeCast.Total);
        }
        public void GetCastSizeRowValues_ProjectHasManyBooksWithManySpeakingParts_SmallCastStaysSmall()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.ACT, TestProject.TestBook.RUT,
                                                            TestProject.TestBook.JUD, TestProject.TestBook.LUK, TestProject.TestBook.JOS);

            TestProject.SimulateDisambiguationForAllBooks(testProject);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = 1;
            model.FemaleNarrators = 1;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(15, smallCast.Male);
            // 15 is actually big enough if the extra-biblical roles are assigned to a female actor, but our cast size estimates don't currently allow for this
            Assert.AreEqual(5, smallCast.Female);
            Assert.AreEqual(1, smallCast.Child);
            Assert.AreEqual(21, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(22, recommendedCast.Male);
            Assert.AreEqual(7, recommendedCast.Female);
            Assert.AreEqual(1, recommendedCast.Child);
            Assert.AreEqual(30, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(29, largeCast.Male);             // TODO: Talk to Duane about logic for this
            Assert.AreEqual(9, largeCast.Female);
            Assert.AreEqual(1, largeCast.Child);
            Assert.AreEqual(39, largeCast.Total);
        }
        public void GetCastSizeRowValues_ProjectHasSingleBookWithNoSpeakingParts_AllCastSizesHaveTwoMalesForNarratorAndExtra()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.PHM);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(2, smallCast.Male);
            Assert.AreEqual(0, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(2, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(2, recommendedCast.Male);
            Assert.AreEqual(0, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(2, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(2, largeCast.Male);
            Assert.AreEqual(0, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(2, largeCast.Total);
        }
        public void GetCastSizeRowValues_ProjectHasSingleBookWithThreeMaleSpeakingPartsCloseTogether_AllCastSizesHaveFiveMales
            ()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.JUD);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(5, smallCast.Male);
            Assert.AreEqual(0, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(5, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(5, recommendedCast.Male);
            Assert.AreEqual(0, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(5, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(5, largeCast.Male);
            Assert.AreEqual(0, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(5, largeCast.Total);
        }
        public void GetCastSizeRowValues_ProjectHasSingleBookWithManySpeakingPartsNoChildren_NoChildrenInCastSizes()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.ACT);

            TestProject.SimulateDisambiguationForAllBooks(testProject);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(15, smallCast.Male);
            Assert.AreEqual(2, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(17, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(22, recommendedCast.Male);
            Assert.AreEqual(3, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(25, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(29, largeCast.Male);             // TODO: Talk to Duane about logic for this
            Assert.AreEqual(4, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(33, largeCast.Total);
        }
        GetCastSizeRowValues_ProjectHasTwoBooksWithNoSpeakingPartsCustomNarratorValues_AllCastSizesHaveBasedOnCustomNarratorsPlusExtraMale
            ()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.IIJN, TestProject.TestBook.IIIJN);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = 1;
            model.FemaleNarrators = 1;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(2, smallCast.Male);
            Assert.AreEqual(1, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(3, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(2, recommendedCast.Male);
            Assert.AreEqual(1, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(3, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(2, largeCast.Male);
            Assert.AreEqual(1, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(3, largeCast.Total);
        }
        GetCastSizeRowValues_ProjectHasTwoBooksBySameAuthorsWithNoSpeakingParts_AllCastSizesHaveTwoMalesForNarratorAndExtra()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.IIJN, TestProject.TestBook.IIIJN);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption = NarratorsOption.NarrationByAuthor;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(2, smallCast.Male);
            Assert.AreEqual(0, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(2, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(2, recommendedCast.Male);
            Assert.AreEqual(0, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(2, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(2, largeCast.Male);
            Assert.AreEqual(0, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(2, largeCast.Total);
        }
        public void GetCastSizeRowValues_ProjectHasManyBooksWithManySpeakingParts_SmallCastStaysSmall()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.ACT, TestProject.TestBook.RUT,
                                                            TestProject.TestBook.JUD, TestProject.TestBook.LUK, TestProject.TestBook.JOS);

            TestProject.SimulateDisambiguationForAllBooks(testProject);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = 1;
            model.FemaleNarrators = 1;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(9, smallCast.Male);
            Assert.AreEqual(5, smallCast.Female);
            Assert.AreEqual(1, smallCast.Child);
            Assert.AreEqual(15, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(13, recommendedCast.Male);
            Assert.AreEqual(7, recommendedCast.Female);
            Assert.AreEqual(1, recommendedCast.Child);
            Assert.AreEqual(21, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(17, largeCast.Male);             // TODO: Talk to Duane about logic for this
            Assert.AreEqual(9, largeCast.Female);
            Assert.AreEqual(1, largeCast.Child);
            Assert.AreEqual(27, largeCast.Total);
        }
        public void SetCastSizeOptionValues(CastSizePlanningViewModel model)
        {
            SetRowValues(CastSizeOption.Small, model.GetCastSizeRowValues(CastSizeOption.Small));
            SetRowValues(CastSizeOption.Recommended, model.GetCastSizeRowValues(CastSizeOption.Recommended));
            SetRowValues(CastSizeOption.Large, model.GetCastSizeRowValues(CastSizeOption.Large));
            SetRowValues(CastSizeOption.Custom, model.GetCastSizeRowValues(CastSizeOption.Custom));
            SetRowValues(CastSizeOption.MatchVoiceActorList, model.GetCastSizeRowValues(CastSizeOption.MatchVoiceActorList));

            // disable 'Match Voice Actor List' if there are no voice actors
            m_rbMatchVoiceActorList.Enabled = model.HasVoiceActors;
            if (m_rbMatchVoiceActorList.Checked && !m_rbMatchVoiceActorList.Enabled)
            {
                SelectedCastSizeRow = CastSizeOption.Recommended;
            }
        }
        void m_viewModel_CastSizeRowValuesChanged(object sender, CastSizeValueChangedEventArgs e)
        {
            SetRowValues(e.Row, e.RowValues);

            if (e.KeepSelection || (e.Row != CastSizeOption.MatchVoiceActorList))
            {
                return;
            }

            // if there are too few actors, make sure "Match Voice Actor List" is not selected
            var small = m_viewModel.GetCastSizeRowValues(CastSizeOption.Small);

            if ((e.RowValues.Male < small.Male) ||
                (e.RowValues.Female < small.Female) ||
                (e.RowValues.Child < small.Child))
            {
                if (SelectedCastSizeRow == CastSizeOption.MatchVoiceActorList)
                {
                    SelectedCastSizeRow = CastSizeOption.Recommended;
                }
            }
            else
            {
                SelectedCastSizeRow = CastSizeOption.MatchVoiceActorList;
            }
        }
        public void GetCastSizeRowValues_HebrewsWithLotsOfScriptureQuotes_CastSizeDependsOnHowScriptureQuotationsAreDramatized(DramatizationOption scriptureQuotationsSpokenBy, int expectedBaseNNumberOfMaleActors)
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.HEB);

            //testProject.IncludedBooks.Single().GetBlocksForVerse()
            testProject.DramatizationPreferences.ScriptureQuotationsShouldBeSpokenBy = scriptureQuotationsSpokenBy;
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            Assert.AreEqual(expectedBaseNNumberOfMaleActors + 2, model.GetCastSizeRowValues(CastSizeOption.Small).Male);
        }
        public void GetCastSizeRowValues_ProjectHasSingleBookNarratedByAFemaleWithFourWomenInCloseProximity_MinimumCastHasFiveFemales()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.RUT);

            TestProject.SimulateDisambiguationForAllBooks(testProject);
            var harvestersBlock = testProject.IncludedBooks[0].GetScriptBlocks().First(b => b.ChapterNumber == 2 &&
                                                                                       b.InitialStartVerseNumber == 4 && !b.ContainsVerseNumber);

            harvestersBlock.CharacterId = "harvesters";
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = 0;
            model.FemaleNarrators = 1;

            var smallCast = model.GetCastSizeRowValues(CastSizeOption.Small);

            Assert.AreEqual(4, smallCast.Male);
            Assert.AreEqual(5, smallCast.Female);
            Assert.AreEqual(0, smallCast.Child);
            Assert.AreEqual(9, smallCast.Total);

            var recommendedCast = model.GetCastSizeRowValues(CastSizeOption.Recommended);

            Assert.AreEqual(5, recommendedCast.Male);
            Assert.AreEqual(5, recommendedCast.Female);
            Assert.AreEqual(0, recommendedCast.Child);
            Assert.AreEqual(10, recommendedCast.Total);

            var largeCast = model.GetCastSizeRowValues(CastSizeOption.Large);

            Assert.AreEqual(6, largeCast.Male);
            Assert.AreEqual(5, largeCast.Female);
            Assert.AreEqual(0, largeCast.Child);
            Assert.AreEqual(11, largeCast.Total);
        }