public void Transform()
        {
            UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock();
            UnityEventListenerMock failedListenerMock      = new UnityEventListenerMock();

            subject.Transformed.AddListener(transformedListenerMock.Listen);
            subject.Failed.AddListener(failedListenerMock.Listen);
            FloatObservableList collection = containingObject.AddComponent <FloatObservableList>();

            subject.Collection = collection;
            subject.Collection.Add(0f);
            subject.Collection.Add(0f);

            subject.Collection.SetAt(2f, 0);

            Assert.AreEqual(0f, subject.Result);
            Assert.IsFalse(transformedListenerMock.Received);
            Assert.IsFalse(failedListenerMock.Received);

            subject.Collection.CurrentIndex = 1;
            float result = subject.Transform(2f);

            Assert.AreEqual(4f, result);
            Assert.AreEqual(4f, subject.Result);
            Assert.IsTrue(transformedListenerMock.Received);
            Assert.IsFalse(failedListenerMock.Received);
        }
Beispiel #2
0
        public void Transform()
        {
            UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock();

            subject.Transformed.AddListener(transformedListenerMock.Listen);
            subject.SetMultiplier(2f);

            Assert.AreEqual(0f, subject.Result);
            Assert.IsFalse(transformedListenerMock.Received);

            float result = subject.Transform(2f);

            Assert.AreEqual(4f, result);
            Assert.AreEqual(4f, subject.Result);
            Assert.IsTrue(transformedListenerMock.Received);
        }
        public void Transform()
        {
            UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock();

            subject.Transformed.AddListener(transformedListenerMock.Listen);
            subject.collection = new List <float>(new float[2]);
            subject.SetElement(0, 2f);

            Assert.AreEqual(0f, subject.Result);
            Assert.IsFalse(transformedListenerMock.Received);

            subject.CurrentIndex = 1;
            float result = subject.Transform(2f);

            Assert.AreEqual(4f, result);
            Assert.AreEqual(4f, subject.Result);
            Assert.IsTrue(transformedListenerMock.Received);
        }