Exemplo n.º 1
0
        public void EnumPreviousTest()
        {
            var model = new GenericStateModel <Fixture>(Fixture.Qux);

            Assert.AreEqual(Fixture.Qux, model.GetCurrent());
            model.Previous();
            Assert.AreEqual(Fixture.Baz, model.GetCurrent());
            model.Previous();
            model.Previous();
            Assert.AreEqual(Fixture.Foo, model.GetCurrent());
            model.Previous();
            model.Previous();
            Assert.AreEqual(Fixture.Foo, model.GetCurrent());
        }
Exemplo n.º 2
0
        public void PrimitiveTest()
        {
            var model1 = new GenericStateModel <int>();

            model1.Change(2);
            Assert.Throws <InvalidOperationException>(() => model1.Next());
            Assert.Throws <InvalidOperationException>(() => model1.Previous());
            var model2 = new GenericStateModel <bool>();

            model2.Change(false);
            Assert.Throws <InvalidOperationException>(() => model2.Next());
            Assert.Throws <InvalidOperationException>(() => model2.Previous());
        }