コード例 #1
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());
        }
コード例 #2
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());
        }
コード例 #3
0
        public void EnumNextTest()
        {
            var model = new GenericStateModel <Fixture>();

            Assert.AreEqual(default(Fixture), model.GetCurrent());
            model.Next();
            model.Next();
            Assert.AreEqual(Fixture.Baz, model.GetCurrent());
            model.Next();
            Assert.AreEqual(Fixture.Qux, model.GetCurrent());
            model.Next();
            model.Next();
            Assert.AreEqual(Fixture.Qux, model.GetCurrent());
        }