public void ProcessNow() { MockProcessable mockProcessable = new MockProcessable(); subject.Source = new ProcessContainer { Interface = mockProcessable }; containingObject.SetActive(true); Assert.IsFalse(mockProcessable.WasProcessCalled); mockProcessable.Reset(); subject.ProcessNow(); Assert.IsTrue(mockProcessable.WasProcessCalled); mockProcessable.Reset(); subject.enabled = false; subject.ProcessNow(); Assert.IsFalse(mockProcessable.WasProcessCalled); mockProcessable.Reset(); subject.enabled = true; containingObject.SetActive(false); subject.ProcessNow(); Assert.IsFalse(mockProcessable.WasProcessCalled); mockProcessable.Reset(); containingObject.SetActive(true); subject.Source = null; subject.ProcessNow(); Assert.IsFalse(mockProcessable.WasProcessCalled); }
public void Process() { MockProcessable mockProcessable1 = new MockProcessable(); MomentProcess momentProcess1 = containingObject.AddComponent <MomentProcess>(); momentProcess1.Source = new ProcessContainer { Interface = mockProcessable1 }; MockProcessable mockProcessable2 = new MockProcessable(); MomentProcess momentProcess2 = containingObject.AddComponent <MomentProcess>(); momentProcess2.Source = new ProcessContainer { Interface = mockProcessable2 }; subject.Processes.Add(momentProcess1); subject.Processes.Add(momentProcess2); Assert.IsFalse(mockProcessable1.WasProcessCalled); Assert.IsFalse(mockProcessable2.WasProcessCalled); subject.Process(); Assert.IsTrue(mockProcessable1.WasProcessCalled); Assert.IsTrue(mockProcessable2.WasProcessCalled); }
public void ProcessNestedList() { MockProcessable mockProcessable1 = new MockProcessable(); MomentProcess momentProcess1 = containingObject.AddComponent <MomentProcess>(); momentProcess1.Source = new ProcessContainer { Interface = mockProcessable1 }; MockProcessable mockProcessable2 = new MockProcessable(); MomentProcess momentProcess2 = containingObject.AddComponent <MomentProcess>(); momentProcess2.Source = new ProcessContainer { Interface = mockProcessable2 }; subject.Processes.Add(momentProcess1); subject.Processes.Add(momentProcess2); GameObject anotherObject = new GameObject(); CompositeProcess anotherCompositeProcess = anotherObject.AddComponent <CompositeProcess>(); anotherCompositeProcess.Processes = anotherObject.AddComponent <MomentProcessObservableList>(); MockProcessable mockProcessable3 = new MockProcessable(); MomentProcess momentProcess3 = containingObject.AddComponent <MomentProcess>(); momentProcess3.Source = new ProcessContainer { Interface = mockProcessable3 }; MockProcessable mockProcessable4 = new MockProcessable(); MomentProcess momentProcess4 = containingObject.AddComponent <MomentProcess>(); momentProcess4.Source = new ProcessContainer { Interface = mockProcessable4 }; anotherCompositeProcess.Processes.Add(momentProcess3); anotherCompositeProcess.Processes.Add(momentProcess4); MomentProcess nestedProcess = containingObject.AddComponent <MomentProcess>(); nestedProcess.Source = new ProcessContainer { Interface = anotherCompositeProcess }; subject.Processes.Add(nestedProcess); Assert.IsFalse(mockProcessable1.WasProcessCalled); Assert.IsFalse(mockProcessable2.WasProcessCalled); Assert.IsFalse(mockProcessable3.WasProcessCalled); Assert.IsFalse(mockProcessable4.WasProcessCalled); subject.Process(); Assert.IsTrue(mockProcessable1.WasProcessCalled); Assert.IsTrue(mockProcessable2.WasProcessCalled); Assert.IsTrue(mockProcessable3.WasProcessCalled); Assert.IsTrue(mockProcessable4.WasProcessCalled); }
public void Process() { MockProcessable mockProcessable = new MockProcessable(); subject.Source = new ProcessContainer { Interface = mockProcessable }; containingObject.SetActive(true); Assert.IsFalse(mockProcessable.WasProcessCalled); subject.Process(); Assert.IsTrue(mockProcessable.WasProcessCalled); mockProcessable.Reset(); subject.NextProcessTime = Time.time + 1f; Assert.IsFalse(mockProcessable.WasProcessCalled); }