Пример #1
0
        public void SetUp()
        {
            test    = new Test("my test");
            service = new TestConverter();

            listener1 = MockRepository.GenerateMock <ITestStateListener>();
            listener2 = MockRepository.GenerateMock <ITestStateListener>();
            listener3 = MockRepository.GenerateMock <ITestStateListener>();

            manager = new TestStateManager(service, test);

            manager.RegisterListener(listener1);
            manager.RegisterListener(listener2);
            manager.RegisterListener(listener3);
        }
Пример #2
0
        public void SetUp()
        {
            test    = new Test("my test");
            service = MockRepository.GenerateMock <ITestConverter>();

            listener1 = MockRepository.GenerateMock <ITestStateListener>();
            source    = MockRepository.GenerateMock <ITestStateListener>();
            listener3 = MockRepository.GenerateMock <ITestStateListener>();

            manager = new TestStateManager(service, test);

            manager.RegisterListener(listener1);
            manager.RegisterListener(source);
            manager.RegisterListener(listener3);

            theNewJson = "{new: 'json'}";

            manager.StoreJson(theNewJson, source);
        }
Пример #3
0
        public void SetUp()
        {
            test    = new Test("my test");
            service = MockRepository.GenerateMock <ITestConverter>();

            listener1 = MockRepository.GenerateMock <ITestStateListener>();
            source    = MockRepository.GenerateMock <ITestStateListener>();
            listener3 = MockRepository.GenerateMock <ITestStateListener>();

            manager = new TestStateManager(service, test);

            manager.RegisterListener(listener1);
            manager.RegisterListener(source);
            manager.RegisterListener(listener3);

            theNewJson = "{new: 'json'}";

            service.Expect(x => x.ToJson(test)).Return(theNewJson);

            manager.Version(source);
        }
Пример #4
0
        public void SetUp()
        {
            test    = new Test("my test");
            service = MockRepository.GenerateMock <ITestConverter>();

            listener1 = MockRepository.GenerateMock <ITestStateListener>();
            listener2 = MockRepository.GenerateMock <ITestStateListener>();
            listener3 = MockRepository.GenerateMock <ITestStateListener>();

            manager = new TestStateManager(service, test);

            manager.RegisterListener(listener1);
            manager.RegisterListener(listener2);
            manager.RegisterListener(listener3);

            theOriginalJson = "{old: 'json'}";
            theNewJson      = "{new: 'json'}";

            service.Expect(x => x.ToJson(test)).Return(theOriginalJson);
            service.Expect(x => x.ToJson(test)).Return(theNewJson);


            manager = new TestStateManager(service, test);
            // setting the pre-condition here
            manager.CurrentJson.ShouldEqual(theOriginalJson);

            manager.Version(null);
            // second version of the JSON
            manager.CurrentJson.ShouldEqual(theNewJson);

            manager.RecordSnapshot();
            manager.IsDirty().ShouldBeFalse();

            manager.RegisterListener(listener1);
            manager.RegisterListener(listener2);
            manager.RegisterListener(listener3);

            // After all that, undo
            manager.Undo.Execute(null);
        }
Пример #5
0
        public void go_forward()
        {
            var listener = MockRepository.GenerateMock <ITestStateListener>();

            manager.RegisterListener(listener);


            manager.Redo.Execute(null);

            manager.IsDirty().ShouldBeFalse();
            manager.CurrentJson.ShouldEqual(theNewJson);
            manager.Redo.Enabled.ShouldBeFalse();
            manager.Undo.Enabled.ShouldBeTrue();
        }