public void Initialize()
        {
            var host   = new Mock <ITextTransformerHost>();
            var engine = new Mock <ITextTemplatingEngine>();

            _appDomainManager.Setup(a => a.Create(It.IsAny <string>())).Returns(_appDomain);
            _appDomainManager.Setup(a => a.Unload(_appDomain)).Verifiable(); //Should be called

            var transformer = new DomainTextTransformer(_appDomainManager.Object, host.Object, engine.Object);

            transformer.Dispose();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Toggles the template domain.
        /// </summary>
        internal void ToggleTemplateDomain()
        {
            transformer.ClassDefinitionGenerated -= Host_ClassDefinitionGenerated;

            if (domain == null)
            {
                domain                  = new DomainTextTransformer();
                domain.AutoRecycle      = true;
                domain.RecycleThreshold = 5;
                TemplateDomainAction    = TemplateDomainActionUnload;
                transformer             = domain;
            }
            else
            {
                domain.Dispose();
                domain = null;
                TemplateDomainAction = TemplateDomainActionCreate;
                transformer          = new TextTransformer();
            }

            transformer.ClassDefinitionGenerated += Host_ClassDefinitionGenerated;

            RefreshDomainProperties();
        }
Ejemplo n.º 3
0
 public void CleanUp()
 {
     _transformer.Dispose();
 }
 public void CleanUp()
 {
     _transformer.Dispose();
     AppDomain.Unload(_appDomain);
 }