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);
        }
        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_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);
        }
        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_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);
        }
示例#6
0
        private void SetProject(Project project)
        {
            if (m_project != null)
            {
                m_project.ProjectStateChanged             -= FinishSetProjectIfReady;
                m_project.CharacterGroupCollectionChanged -= UpdateDisplayOfCastSizePlan;
                m_project.CharacterGroupCollectionChanged -= ClearCastSizePlanningViewModel;
                m_project.CharacterStatisticsCleared      -= ClearCastSizePlanningViewModel;
            }

            m_projectCastSizePlanningViewModel = null;
            m_project = project;

            if (m_project != null)
            {
                m_project.ProjectStateChanged             += FinishSetProjectIfReady;
                m_project.CharacterGroupCollectionChanged += UpdateDisplayOfCastSizePlan;
                m_project.CharacterGroupCollectionChanged += ClearCastSizePlanningViewModel;
                m_project.CharacterStatisticsCleared      += ClearCastSizePlanningViewModel;
            }

            ResetUi();

            if (m_project != null && (m_project.ProjectState & ProjectState.ReadyForUserInteraction) == 0)
            {
                return;                 //FinishSetProject will be called by the event handler
            }
            FinishSetProject();
        }
        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_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);
        }
        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);
        }
        private CastSizePlanningViewModel CreateModelWithInitialCustomValues(Glyssen.Project project, int maleNarrators, int femaleNarrators)
        {
            var model = new CastSizePlanningViewModel(project);

            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = maleNarrators;
            model.FemaleNarrators = femaleNarrators;
            return(model);
        }
        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 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;
            }
        }
        public void SetNarratorOption_CallbackPublishesValues()
        {
            var testProject = TestProject.CreateTestProject(TestProject.TestBook.PHM, TestProject.TestBook.IIIJN);
            CastSizePlanningViewModel model = new CastSizePlanningViewModel(testProject);

            model.MaleNarratorsValueChanged   += model_MaleNarratorsValueChanged;
            model.FemaleNarratorsValueChanged += model_FemaleNarratorsValueChanged;
            model.NarratorOption  = NarratorsOption.Custom;
            model.MaleNarrators   = 1;
            model.FemaleNarrators = 1;
            model.NarratorOption  = NarratorsOption.NarrationByAuthor;
            Assert.AreEqual(2, m_maleNarratorsValue);
            Assert.AreEqual(0, m_femaleNarratorsValue);
            model.NarratorOption = NarratorsOption.SingleNarrator;
            Assert.AreEqual(1, m_maleNarratorsValue);
            Assert.AreEqual(0, m_femaleNarratorsValue);
            model.NarratorOption = NarratorsOption.Custom;
            Assert.AreEqual(1, m_maleNarratorsValue);
            Assert.AreEqual(1, m_femaleNarratorsValue);
        }
        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);
        }
示例#15
0
 private void ClearCastSizePlanningViewModel(object sender, EventArgs e)
 {
     m_projectCastSizePlanningViewModel = null;
 }
 public void SetViewModel(CastSizePlanningViewModel viewModel)
 {
     m_viewModel = viewModel;
     SetCastSizeOptionValues(m_viewModel);
     m_viewModel.CastSizeRowValuesChanged += m_viewModel_CastSizeRowValuesChanged;
 }
 private void VerifyThatModelAndDlgAreInSync(CastSizePlanningViewModel model, MockCastSizePlanningDialog dlg)
 {
     Assert.AreEqual(model.MaleNarrators, dlg.MaleNarratorsValue);
     Assert.AreEqual(model.FemaleNarrators, dlg.FemaleNarratorsValue);
 }
 public MockCastSizePlanningDialog(CastSizePlanningViewModel model)
 {
     model.MaleNarratorsValueChanged   += model_MaleNarratorsValueChanged;
     model.FemaleNarratorsValueChanged += model_FemaleNarratorsValueChanged;
 }