public void WhenInitialized_ClassesCollectionIsEmpty()
        {
            var target = new TsModule("Tests");

            Assert.NotNull(target.Classes);
            Assert.Empty(target.Classes);
        }
        public void WhenInitialized_NameIsSet()
        {
            var target = new TsModule("Tests");

            Assert.Equal("Tests", target.Name);
        }
 /// <summary>
 /// When overridden in a derived class, it can examine or modify the script module.
 /// </summary>
 /// <param name="module">The module being visited.</param>
 public virtual void VisitModule(TsModule module)
 {
 }
Exemplo n.º 4
0
        /// <summary>
        /// Resolves module instance from the module name.
        /// </summary>
        /// <param name="name">The name of the module</param>
        /// <returns></returns>
        private TsModule ResolveModule(string name)
        {
            name = name ?? string.Empty;

            if (_modules.ContainsKey(name)) {
                return _modules[name];
            }

            var module = new TsModule(name);
            _modules[name] = module;
            _model.Modules.Add(module);
            return module;
        }
Exemplo n.º 5
0
        public void WhenModuleIsSet_ClassIsAddedToModule()
        {
            var module = new TsModule("Tests");
            var target = new TsClass(typeof(Address));

            target.Module = module;

            Assert.Contains(target, module.Classes);
        }
Exemplo n.º 6
0
        public void WhenModuleIsSetToOtherModule_ClassIsRemovedFromOriginalModule()
        {
            var originalModule = new TsModule("Tests.Original");
            var module = new TsModule("Tests");
            var target = new TsClass(typeof(Address));

            target.Module = originalModule;
            target.Module = module;

            Assert.DoesNotContain(target, originalModule.Classes);
        }