コード例 #1
0
        public void big_integrated_smoke_test()
        {
            var pipeline = new StubAssetPipeline();
            var listener = MockRepository.GenerateMock <IAssetFileChangeListener>();


            var watcher = new AssetFileWatcher(pipeline, listener, new AssetFileMonitoringSettings {
                MonitoringIntervalTime = 100
            });

            try
            {
                var file1 = pipeline.AddFile("1");
                var file2 = pipeline.AddFile("2");
                var file3 = pipeline.AddFile("3");
                var file4 = pipeline.AddFile("4");
                var file5 = pipeline.AddFile("5");

                Thread.Sleep(1001);

                watcher.StartWatchingAll();

                listener.AssertWasNotCalled(x => x.Changed(null), x => x.IgnoreArguments());

                pipeline.AlterFile("1");
                pipeline.AlterFile("3");
                pipeline.AlterFile("5");

                Thread.Sleep(1001);

                listener.AssertWasCalled(x => x.Changed(file1));
                listener.AssertWasNotCalled(x => x.Changed(file2));
                listener.AssertWasCalled(x => x.Changed(file3));
                listener.AssertWasNotCalled(x => x.Changed(file4));
                listener.AssertWasCalled(x => x.Changed(file5));
            }
            finally
            {
                watcher.StopWatching();
            }
        }
コード例 #2
0
        public void big_integrated_smoke_test()
        {
            var pipeline = new StubAssetPipeline();
            var listener = MockRepository.GenerateMock<IAssetFileChangeListener>();

            var watcher = new AssetFileWatcher(pipeline, listener, new AssetFileMonitoringSettings{
                MonitoringIntervalTime = 100
            });

            try
            {
                var file1 = pipeline.AddFile("1");
                var file2 = pipeline.AddFile("2");
                var file3 = pipeline.AddFile("3");
                var file4 = pipeline.AddFile("4");
                var file5 = pipeline.AddFile("5");

                Thread.Sleep(1001);

                watcher.StartWatchingAll();

                listener.AssertWasNotCalled(x => x.Changed(null), x => x.IgnoreArguments());

                pipeline.AlterFile("1");
                pipeline.AlterFile("3");
                pipeline.AlterFile("5");

                Thread.Sleep(1001);

                listener.AssertWasCalled(x => x.Changed(file1));
                listener.AssertWasNotCalled(x => x.Changed(file2));
                listener.AssertWasCalled(x => x.Changed(file3));
                listener.AssertWasNotCalled(x => x.Changed(file4));
                listener.AssertWasCalled(x => x.Changed(file5));
            }
            finally
            {
                watcher.StopWatching();
            }
        }