Ejemplo n.º 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);
        }
		/// <summary>
		/// Create a cache based on the script storage method
		/// </summary>
		/// <param name="storage"></param>
		public DslCompilerContextCache(IDslEngineStorage storage)
		{
			this.storage = storage;
		}
Ejemplo n.º 3
0
 /// <summary>
 /// Create a cache based on the script storage method
 /// </summary>
 /// <param name="storage"></param>
 public DslCompilerContextCache(IDslEngineStorage storage)
 {
     this.storage = storage;
 }