Example #1
0
        public DslFactoryFixture()
        {
            factory         = new DslFactory();
            mocks           = new MockRepository();
            mockedDslEngine = mocks.DynamicMock <DslEngine>();
            mockCache       = mocks.DynamicMock <IDslEngineCache>();

            mockCache.WriteLock(null);
            LastCall.Repeat.Any()
            .IgnoreArguments()
            .Do((Action <CacheAction>)ExecuteCachedAction);

            mockCache.ReadLock(null);
            LastCall.Repeat.Any()
            .IgnoreArguments()
            .Do((Action <CacheAction>)ExecuteCachedAction);

            IDslEngineStorage mockStorage = mocks.DynamicMock <IDslEngineStorage>();
            Assembly          assembly    = Assembly.GetCallingAssembly();

            context = new CompilerContext();
            context.GeneratedAssembly = assembly;
            mockedDslEngine.Storage   = mockStorage;
            mockedDslEngine.Cache     = mockCache;

            SetupResult.For(mockStorage.GetMatchingUrlsIn("", ref testUrl)).Return(new string[] { testUrl });
            SetupResult.For(mockStorage.IsUrlIncludeIn(null, null, null))
            .IgnoreArguments()
            .Return(true);
        }
        public DslFactoryFixture()
        {
            factory = new DslFactory();
            mocks = new MockRepository();
            mockedDslEngine = mocks.DynamicMock<DslEngine>();
            mockCache = mocks.DynamicMock<IDslEngineCache>();
        	
			mockCache.WriteLock(null);
        	LastCall.Repeat.Any()
        		.IgnoreArguments()
        		.Do((Action<CacheAction>) ExecuteCachedAction);
			
			mockCache.ReadLock(null);
			LastCall.Repeat.Any()
				.IgnoreArguments()
				.Do((Action<CacheAction>)ExecuteCachedAction);
            
			IDslEngineStorage mockStorage = mocks.DynamicMock<IDslEngineStorage>();
            Assembly assembly = Assembly.GetCallingAssembly();
            context = new CompilerContext();
            context.GeneratedAssembly = assembly;
            mockedDslEngine.Storage = mockStorage;
            mockedDslEngine.Cache = mockCache;

            SetupResult.For(mockStorage.GetMatchingUrlsIn("", ref testUrl)).Return(new string[] { testUrl });
            SetupResult.For(mockStorage.IsUrlIncludeIn(null, null, null))
                .IgnoreArguments()
                .Return(true);
        }