Exemple #1
0
        public void CombineTriggersToAxisTest()
        {
            TriggerStub      positive = new TriggerStub("positive");
            TriggerStub      negative = new TriggerStub("negative");
            ValueSpy <float> spy      = new ValueSpy <float>(Combine.TriggersToAxis(positive, negative));

            spy.WaitFrame();
            spy.AssertNothingHappened();

            positive.Update(true);
            spy.WaitFrame();
            spy.AssertWasUpdatedTo(1);

            negative.Update(true);
            spy.WaitFrame();
            spy.AssertWasUpdatedTo(0);

            positive.Update(false);
            spy.WaitFrame();
            spy.AssertWasUpdatedTo(-1);

            spy.WaitFrame();
            spy.AssertNothingHappened();
        }