Пример #1
0
        public IEnumerator UnlockedAfterManualUnlockStarted()
        {
            // Given a scene object with a lockable property which is not referenced by any condition.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            EndlessConditionMock condition = new EndlessConditionMock();

            Step step2 = new BasicStepBuilder("step").AddCondition(new EndlessConditionMock()).Build();
            Step step  = new BasicStepBuilder("step").AddCondition(condition).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            property.SetLocked(true);

            // When we include the property into the manualUnlocked list of the UnlockPropertiesForStepData method.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData> {
                new LockablePropertyData(property)
            });

            // Then the property is not locked.
            Assert.IsFalse(property.IsLocked);

            yield return(null);
        }
Пример #2
0
        public IEnumerator SamePropertyInSecondStepStaysUnlocked()
        {
            // Given a scene object with a lockable property which is referenced in the transitions of the first and second step
            // and should normally lock at the end of a step.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock lockAtEndOfStepCondition = new LockableReferencingConditionMock();

            lockAtEndOfStepCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            lockAtEndOfStepCondition.LockableProperties        = new[] { new LockablePropertyData(property, true) };

            Step step2 = new BasicStepBuilder("step2").AddCondition(lockAtEndOfStepCondition).Build();

            Step step = new BasicStepBuilder("step").AddCondition(lockAtEndOfStepCondition).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            // When executing the locking routine in the first step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData>());

            // Then the property is not locked at the end of the first step because it is needed in the second step.
            Assert.IsFalse(property.IsLocked);

            yield return(null);
        }
Пример #3
0
        public IEnumerator KeepUnlockedAtEndPropertyIsUnlockedAfterFinishingStep()
        {
            // Given a transition with a condition referencing a scene object with a lockable property
            // that should not be locked in the end of a step.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock doNotLockAtEndOfStepCondition = new LockableReferencingConditionMock();

            doNotLockAtEndOfStepCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            doNotLockAtEndOfStepCondition.LockableProperties        = new[] { new LockablePropertyData(property, false) };

            Step step2 = new BasicStepBuilder("step2").Build();

            Step step = new BasicStepBuilder("step").AddCondition(doNotLockAtEndOfStepCondition).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            // When executing the locking routine and completing the step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData>());

            // Then the property is not locked in the end.
            Assert.IsFalse(property.IsLocked);

            yield return(null);
        }
Пример #4
0
        public IEnumerator OtherPropertyLockedAfterManualUnlockFinished()
        {
            // Given a scene object with two independent lockable properties which are not referenced by any condition.
            ISceneObject         o1        = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property  = o1.GameObject.AddComponent <LockablePropertyMock>();
            LockablePropertyMock property2 = o1.GameObject.AddComponent <LockablePropertyMock>();

            EndlessConditionMock condition = new EndlessConditionMock();

            Step step2 = new BasicStepBuilder("step").AddCondition(new EndlessConditionMock()).Build();
            Step step  = new BasicStepBuilder("step").AddCondition(condition).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            property.SetLocked(true);
            property2.SetLocked(true);

            // When we manually unlock one property for one step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData> {
                new LockablePropertyData(property)
            });

            // Then the other property stays locked after the step was completed.
            Assert.IsTrue(property2.IsLocked);

            yield return(null);
        }
Пример #5
0
        public IEnumerator DependencyGetsLocked()
        {
            // Given a scene object with one lockable property with dependency.
            ISceneObject         o1         = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock dependency = o1.GameObject.AddComponent <LockablePropertyMock>();
            LockablePropertyMockWithDependency propertyWithDependency = o1.GameObject.AddComponent <LockablePropertyMockWithDependency>();

            Step step2 = new BasicStepBuilder("step").Build();
            Step step  = new BasicStepBuilder("step").AddCondition(new EndlessConditionMock()).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            dependency.SetLocked(true);
            propertyWithDependency.SetLocked(true);

            // When we manually unlock the property for one step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData> {
                new LockablePropertyData(propertyWithDependency)
            });
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData> {
                new LockablePropertyData(propertyWithDependency)
            });

            // Then after the step the dependent property is also locked again.
            Assert.IsTrue(dependency.IsLocked);

            yield return(null);
        }
Пример #6
0
        public IEnumerator GetLockablePropertiesObjectInMultipleConditions()
        {
            // Given a scene object with one lockable property and one non-lockable property used by two conditions in a transition.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            o1.GameObject.AddComponent <PropertyMock>();

            LockableReferencingConditionMock condition1 = new LockableReferencingConditionMock();

            condition1.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            condition1.LockableProperties        = new[] { new LockablePropertyData(property, true) };

            LockableReferencingConditionMock condition2 = new LockableReferencingConditionMock();

            condition2.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            condition2.LockableProperties        = new[] { new LockablePropertyData(property, false) };

            Step step2 = new BasicStepBuilder("step2").Build();
            Step step  = new BasicStepBuilder("step").AddCondition(condition1).AddCondition(condition2).Build();

            Transition transition = (Transition)step.Data.Transitions.Data.Transitions[0];

            transition.Data.TargetStep = step2;

            // When counting the lockable properties in the transition.
            // Then there is exactly one lockable property.
            Assert.IsTrue(transition.GetLockableProperties().Count() == 1);

            yield return(null);
        }
Пример #7
0
        public IEnumerator SecondPropertyStaysLocked()
        {
            // Given two steps and two scene objects with each one lockable property
            // where only the first property is referenced in the first step.
            ISceneObject         o1        = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property1 = o1.GameObject.AddComponent <LockablePropertyMock>();

            ISceneObject         o2        = TestingUtils.CreateSceneObject("o2");
            LockablePropertyMock property2 = o2.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock doNotLockAtEndOfStepCondition = new LockableReferencingConditionMock();

            doNotLockAtEndOfStepCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            doNotLockAtEndOfStepCondition.LockableProperties        = new[] { new LockablePropertyData(property1, false) };

            Step step2 = new BasicStepBuilder("step2").Build();
            Step step  = new BasicStepBuilder("step")
                         .AddCondition(doNotLockAtEndOfStepCondition)
                         .Build();

            property1.SetLocked(true);
            property2.SetLocked(true);

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            // When executing the locking routine in the first step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());

            // Then property 2 is locked during the first step.
            Assert.IsTrue(property2.IsLocked);

            yield return(null);
        }
        /// <summary>
        /// Get builder for a step during which user has to activate some objects.
        /// </summary>
        /// <param name="name">Name of the step.</param>
        /// <param name="objectsToUse">List of objects to use.</param>
        /// <returns>Configured builder.</returns>
        public static BasicStepBuilder Use(string name, params IUsableProperty[] objectsToUse)
        {
            BasicStepBuilder builder = new BasicStepBuilder(name);

            foreach (IUsableProperty objectToUse in objectsToUse)
            {
                builder.AddCondition(new UsedCondition(objectToUse));
            }

            return(builder);
        }
        /// <summary>
        /// Get builder for a step during which user has to put objects into a snap zone.
        /// </summary>
        /// <param name="name">Name of the step.</param>
        /// <param name="snapZone">Snap zone in which user should put objects.</param>
        /// <param name="objectsToPut">List of objects to put into collider.</param>
        /// <returns>Configured builder.</returns>
        public static BasicStepBuilder PutIntoSnapZone(string name, ISnapZoneProperty snapZone, params ISnappableProperty[] objectsToPut)
        {
            BasicStepBuilder builder = new BasicStepBuilder(name);

            foreach (ISnappableProperty objectToPut in objectsToPut)
            {
                builder.AddCondition(new SnappedCondition(objectToPut, snapZone));
            }

            return(builder);
        }
        /// <summary>
        /// Get builder for a step during which user has to touch some objects.
        /// </summary>
        /// <param name="name">Name of the step.</param>
        /// <param name="objectsToTouch">List of objects to touch.</param>
        /// <returns>Configured builder.</returns>
        public static BasicStepBuilder Touch(string name, params string[] objectsToTouch)
        {
            BasicStepBuilder builder = new BasicStepBuilder(name);

            foreach (string objectToTouch in objectsToTouch)
            {
                builder.AddCondition(new TouchedCondition(objectToTouch));
            }

            return(builder);
        }
        /// <summary>
        /// Get grab step builder.
        /// </summary>
        /// <param name="name">Name of the step.</param>
        /// <param name="objectsToGrab">List of objects that have to be grabbed before training chapter continues.</param>
        /// <returns>Configured builder.</returns>
        public static BasicStepBuilder Grab(string name, params string[] objectsToGrab)
        {
            BasicStepBuilder builder = new BasicStepBuilder(name);

            foreach (string objectToGrab in objectsToGrab)
            {
                builder.AddCondition(new GrabbedCondition(objectToGrab));
            }

            return(builder);
        }
Пример #12
0
        public IEnumerator GetLockablePropertiesMultipleObjectsAndConditions()
        {
            // Given three scene objects,
            // one of them with one lockable property and one non-lockable property,
            // one of them with only one non-lockable property,
            // and one of them with only one lockable property,
            // used by three different conditions in a transition.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            o1.GameObject.AddComponent <PropertyMock>();

            ISceneObject o2 = TestingUtils.CreateSceneObject("o2");

            o2.GameObject.AddComponent <PropertyMock>();

            ISceneObject         o3        = TestingUtils.CreateSceneObject("o3");
            LockablePropertyMock property2 = o2.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock condition1 = new LockableReferencingConditionMock();

            condition1.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            condition1.LockableProperties        = new[] { new LockablePropertyData(property, true) };

            ReferencingConditionMock condition2 = new ReferencingConditionMock();

            condition2.Data.PropertyMock = new ScenePropertyReference <PropertyMock>(o2.UniqueName);

            LockableReferencingConditionMock condition3 = new LockableReferencingConditionMock();

            condition3.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o3.UniqueName);
            condition3.LockableProperties        = new[] { new LockablePropertyData(property2, true) };

            Step step2 = new BasicStepBuilder("step2").Build();
            Step step  = new BasicStepBuilder("step")
                         .AddCondition(condition1)
                         .AddCondition(condition2)
                         .AddCondition(condition3)
                         .Build();
            Transition transition = (Transition)step.Data.Transitions.Data.Transitions[0];

            transition.Data.TargetStep = step2;

            // When counting the lockable properties in the transition.
            // Then there are exactly two lockable properties.
            Assert.IsTrue(transition.GetLockableProperties().Count() == 2);

            yield return(null);
        }
Пример #13
0
        public void PasteKeepBehaviorType()
        {
            // Given a step with a behavior
            IStep step = new BasicStepBuilder("Step")
                         .AddBehavior(new EmptyBehaviorMock())
                         .Build();

            // When I copy and paste it
            SystemClipboard.CopyStep(step);
            IStep copy = SystemClipboard.PasteStep();

            // The copy of the behavior has the same type.
            Assert.AreEqual(
                step.Data.Behaviors.Data.Behaviors.First().GetType(),
                copy.Data.Behaviors.Data.Behaviors.First().GetType());
        }
Пример #14
0
        public void PasteWithPrimitiveValue()
        {
            // Given a step with a behavior with a primitive value
            IStep step = new BasicStepBuilder("Step")
                         .AddBehavior(new ValueBehaviorMock(5f))
                         .Build();

            // When I copy and paste it
            SystemClipboard.CopyStep(step);
            IStep copy = SystemClipboard.PasteStep();

            // Then the copy stores the same value as the original behavior.
            Assert.AreEqual(
                ((ValueBehaviorMock)step.Data.Behaviors.Data.Behaviors.First()).Data.Value,
                ((ValueBehaviorMock)copy.Data.Behaviors.Data.Behaviors.First()).Data.Value);
        }
Пример #15
0
        public void PasteWithPropertyReference()
        {
            // Given a step with a behavior with a property reference
            IStep step = new BasicStepBuilder("Step")
                         .AddBehavior(new ObjectReferenceBehaviorMock("Quite unique name"))
                         .Build();

            // When I copy and paste it
            SystemClipboard.CopyStep(step);
            IStep copy = SystemClipboard.PasteStep();

            // Then the copy stores the same value as the original behavior.
            Assert.AreEqual(
                ((ObjectReferenceBehaviorMock)step.Data.Behaviors.Data.Behaviors.First()).Data.ReferenceObject.UniqueName,
                ((ObjectReferenceBehaviorMock)copy.Data.Behaviors.Data.Behaviors.First()).Data.ReferenceObject.UniqueName);
        }
Пример #16
0
        public void PasteWithBehavior()
        {
            // Given a step with a behavior
            IStep step = new BasicStepBuilder("Step")
                         .AddBehavior(new EmptyBehaviorMock())
                         .Build();

            // When I copy and paste it
            SystemClipboard.CopyStep(step);
            IStep copy = SystemClipboard.PasteStep();

            // The copy has a new copy of the behavior
            Assert.IsFalse(ReferenceEquals(
                               step.Data.Behaviors.Data.Behaviors.First(),
                               copy.Data.Behaviors.Data.Behaviors.First()));
        }
Пример #17
0
        public IEnumerator ObjectInConditionIsNotInManualUnlockList()
        {
            // Given a step with a condition with a LockableProperty
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();
            LockableReferencingConditionMock lockCondition = new LockableReferencingConditionMock();

            lockCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            Step step = new BasicStepBuilder("step").AddCondition(lockCondition).Build();

            // When we create a collection referencing this step
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);

            // Then the lockable property is not in the Manual Unlock List of the collection
            Assert.IsFalse(collection.IsInManualUnlockList(lockableProperty));

            yield return(null);
        }
Пример #18
0
        public IEnumerator ManuallyAddedSceneObjectIsNotInAutoUnlockList()
        {
            // Given a step with a condition with a LockableProperty and a collection referencing this step
            Step step = new BasicStepBuilder("step").Build();
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);

            // When we create a SceneObject with a lockable property
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();

            // ...and add the SceneObject and its property to the collection
            collection.AddSceneObject(o1);
            collection.Add(lockableProperty);

            // Then the lockable property is not in the Auto Unlock List of the collection
            Assert.IsFalse(collection.IsInAutoUnlockList(lockableProperty));

            yield return(null);
        }
Пример #19
0
        public IEnumerator RemovedPropertyIsNotInManualUnlockList()
        {
            // Given a step with a condition with a LockableProperty
            Step step = new BasicStepBuilder("step").Build();
            // ...and a collection with a manually added SceneObject and an added lockable property
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();

            collection.AddSceneObject(o1);
            collection.Add(lockableProperty);

            // When we remove the property from the collection
            collection.Remove(lockableProperty);

            // Then the lockable property is not in the Auto Unlock List of the collection
            Assert.IsFalse(collection.IsInAutoUnlockList(lockableProperty));

            yield return(null);
        }
Пример #20
0
        public IEnumerator SecondTransitionIsLocked()
        {
            // Given a step with two different transitions,
            // each of them having an own condition with a lockable property which should not be locked at the end of a step.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            ISceneObject         o2        = TestingUtils.CreateSceneObject("o2");
            LockablePropertyMock property2 = o2.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock doNotLockAtEndOfStepCondition1 = new LockableReferencingConditionMock();

            doNotLockAtEndOfStepCondition1.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            doNotLockAtEndOfStepCondition1.LockableProperties        = new[] { new LockablePropertyData(property, false) };

            LockableReferencingConditionMock doNotLockAtEndOfStepCondition2 = new LockableReferencingConditionMock();

            doNotLockAtEndOfStepCondition2.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o2.UniqueName);
            doNotLockAtEndOfStepCondition2.LockableProperties        = new[] { new LockablePropertyData(property2, false) };

            Step step2 = new BasicStepBuilder("step2").AddCondition(doNotLockAtEndOfStepCondition1).Build();

            Step step = new BasicStepBuilder("step").AddCondition(doNotLockAtEndOfStepCondition1).Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;
            step.Data.Transitions.Data.Transitions.Add(new Transition());
            step.Data.Transitions.Data.Transitions[1].Data.Conditions.Add(doNotLockAtEndOfStepCondition2);

            // When completing only the first transition.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData>());

            // Then the lockable property of the second transition is locked,
            // even though lock at the end of step is set to false.
            Assert.IsTrue(property2.IsLocked);

            yield return(null);
        }
Пример #21
0
        public IEnumerator SecondPropertyGetsLockedAfterNotBeingNeededAnymore()
        {
            // Given two steps and two scene objects with each one lockable property
            // and property 2 (lock at the end of step = true) is referenced only in the first step,
            // whereas property 1 (lock at the end of step = false) is referenced in both steps.
            ISceneObject         o1 = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock DoNotLockAtEndOfStep = o1.GameObject.AddComponent <LockablePropertyMock>();

            ISceneObject         o2 = TestingUtils.CreateSceneObject("o2");
            LockablePropertyMock lockAtEndOfStep = o2.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock doNotLockAtEndOfStepCondition = new LockableReferencingConditionMock();

            doNotLockAtEndOfStepCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            doNotLockAtEndOfStepCondition.LockableProperties        = new[] { new LockablePropertyData(DoNotLockAtEndOfStep, false) };

            LockableReferencingConditionMock lockAtEndOfStepCondition = new LockableReferencingConditionMock();

            lockAtEndOfStepCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o2.UniqueName);
            lockAtEndOfStepCondition.LockableProperties        = new[] { new LockablePropertyData(lockAtEndOfStep, true) };

            Step step2 = new BasicStepBuilder("step2").AddCondition(doNotLockAtEndOfStepCondition).Build();
            Step step  = new BasicStepBuilder("step")
                         .AddCondition(doNotLockAtEndOfStepCondition)
                         .AddCondition(lockAtEndOfStepCondition)
                         .Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            // When executing the locking routine in the first step.
            LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
            step.Data.Transitions.Data.Transitions.First().Autocomplete();
            step.Data.Transitions.Data.Transitions.First().Data.IsCompleted = true;
            LockHandling.Lock(step.Data, new List <LockablePropertyData>());

            // Then property 2 is locked in the end of the first step.
            Assert.IsTrue(lockAtEndOfStep.IsLocked);

            yield return(null);
        }
Пример #22
0
        public IEnumerator EmptyTransition()
        {
            // Given a transition from one step to another without any conditions.
            Step step2 = new BasicStepBuilder("step2").Build();
            Step step  = new BasicStepBuilder("step").Build();

            step.Data.Transitions.Data.Transitions[0].Data.TargetStep = step2;

            // When executing the locking routine in the first step.
            try
            {
                LockHandling.Unlock(step.Data, new List <LockablePropertyData>());
                LockHandling.Lock(step.Data, new List <LockablePropertyData>());
            }
            // Then no exception is thrown.
            catch (Exception exception)
            {
                Assert.Fail("Expected no exception, but got: " + exception.Message);
            }

            yield return(null);
        }
Пример #23
0
        public void PasteWithCondition()
        {
            // Given a step with a transition with a condition,
            IStep step = new BasicStepBuilder("Step")
                         .AddCondition(new EndlessConditionMock())
                         .Build();
            IStep target = new Step("Step 2");

            step.Data.Transitions.Data.Transitions.First().Data.TargetStep = target;

            // When I copy and paste it
            SystemClipboard.CopyStep(step);
            IStep copy = SystemClipboard.PasteStep();

            // Then the copy's transition has a copy of the condition.
            Assert.AreEqual(
                step.Data.Transitions.Data.Transitions.First().Data.Conditions.First().GetType(),
                copy.Data.Transitions.Data.Transitions.First().Data.Conditions.First().GetType());

            Assert.IsFalse(ReferenceEquals(
                               step.Data.Transitions.Data.Transitions.First().Data.Conditions.First(),
                               copy.Data.Transitions.Data.Transitions.First().Data.Conditions.First()));
        }
Пример #24
0
        public IEnumerator GetLockablePropertiesZeroLockables()
        {
            // Given a scene object with one non-lockable property used by a condition in a transition.
            ISceneObject o1 = TestingUtils.CreateSceneObject("o1");

            o1.GameObject.AddComponent <PropertyMock>();

            ReferencingConditionMock condition = new ReferencingConditionMock();

            condition.Data.PropertyMock = new ScenePropertyReference <PropertyMock>(o1.UniqueName);

            Step       step2      = new BasicStepBuilder("step2").Build();
            Step       step       = new BasicStepBuilder("step").AddCondition(condition).Build();
            Transition transition = (Transition)step.Data.Transitions.Data.Transitions[0];

            transition.Data.TargetStep = step2;

            // When counting the lockable properties in the transition.
            // Then there is no lockable property.
            Assert.IsFalse(transition.GetLockableProperties().Any());

            yield return(null);
        }