Beispiel #1
0
        public void GetAvailableValuesTest()
        {
            const uint type = 123;

            int[] values = new int[] { 1, 2, 10 };
            EnumValueCollection collection = new EnumValueCollection();

            collection.Add(new EnumValue(1, "1", 0));
            collection.Add(new EnumValue(2, "2", 0));
            collection.Add(new EnumValue(3, "3", 0));
            collection.Add(new EnumValue(10, "10", 0));

            Mockery mockery = new Mockery();
            ICamera camera  = (ICamera)mockery.NewMock(typeof(ICamera));

            Expect.Once.On(camera).Method("GetAvailableValues").With(type).Will(Return.Value(values));

            EnumValueCollection result = EnumValue.GetListFrom(camera, type, collection);

            Assert.AreEqual(values.Length, result.Count);
            Assert.AreEqual(values[0], result[1].Value);
            Assert.AreEqual(values[1], result[2].Value);
            Assert.AreEqual(values[2], result[10].Value);

            mockery.VerifyAllExpectationsHaveBeenMet();
        }