コード例 #1
0
        public void VoiceActorAddedUndoAction_Redo_Normal_ActorReinstated()
        {
            m_testProject.VoiceActorList.AllActors.Add(
                new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Chuck", Age = ActorAge.YoungAdult
            });
            var action = new VoiceActorAddedUndoAction(m_testProject, 3);

            action.Undo();

            Assert.IsTrue(action.Redo());
            var reAddedActor = m_testProject.VoiceActorList.GetVoiceActorById(3);

            Assert.AreEqual("Chuck", reAddedActor.Name);
            Assert.AreEqual(ActorAge.YoungAdult, reAddedActor.Age);
        }
コード例 #2
0
        public void VoiceActorAddedUndoAction_Redo_AddedActorWithSameNameAfterUndo_ReturnsFalse()
        {
            m_testProject.VoiceActorList.Actors.Add(
                new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Chuck", Age = ActorAge.YoungAdult
            });
            var action = new VoiceActorAddedUndoAction(m_testProject, 3);

            m_testProject.VoiceActorList.Actors.Clear();
            Assert.AreEqual(0, m_testProject.VoiceActorList.Actors.Count);
            action.Undo();
            m_testProject.VoiceActorList.Actors.Add(
                new Glyssen.VoiceActor.VoiceActor {
                Id = 40, Name = "Chuck", Age = ActorAge.Elder
            });

            Assert.IsFalse(action.Redo());
            Assert.AreEqual(ActorAge.Elder, m_testProject.VoiceActorList.Actors.Single().Age);
        }
コード例 #3
0
        public void VoiceActorAddedUndoAction_Redo_AddedDifferentActorWithSameIdAfterUndo_ActorReinstatedWithUniqueId()
        {
            m_testProject.VoiceActorList.Actors.Add(
                new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Chuck", Age = ActorAge.YoungAdult
            });
            var action = new VoiceActorAddedUndoAction(m_testProject, 3);

            m_testProject.VoiceActorList.Actors.Clear();
            Assert.AreEqual(0, m_testProject.VoiceActorList.Actors.Count);
            action.Undo();
            m_testProject.VoiceActorList.Actors.Add(
                new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Maggie", Gender = ActorGender.Female
            });

            Assert.IsTrue(action.Redo());
            Assert.AreEqual(2, m_testProject.VoiceActorList.Actors.Count);
            var reAddedActor = m_testProject.VoiceActorList.Actors.Single(a => a.Id != 3);

            Assert.AreEqual("Chuck", reAddedActor.Name);
            Assert.AreEqual(ActorAge.YoungAdult, reAddedActor.Age);
        }