public void Create()
        {
            var context = new Mock <IContextAware>();

            var language = ScriptLanguage.IronPython;
            var model    = new ScriptDescriptionModel(context.Object, language);

            Assert.AreEqual(language, model.Language);
            Assert.IsNotNull(model.Description);
            Assert.AreNotEqual(string.Empty, model.Description);
        }
示例#2
0
        public void ScriptLanguage()
        {
            var context = new Mock <IContextAware>();
            {
                context.Setup(c => c.IsSynchronized)
                .Returns(true);
            }

            var model = new ScriptModel(context.Object);

            var propertyChangedWasRaised = 0;
            var properties = new List <string>();

            model.PropertyChanged += (s, e) =>
            {
                propertyChangedWasRaised++;
                properties.Add(e.PropertyName);
            };

            var description = new ScriptDescriptionModel(context.Object, Core.Host.Scripting.ScriptLanguage.IronRuby);

            model.ScriptLanguage = description;

            Assert.AreEqual(1, propertyChangedWasRaised);
            Assert.That(
                properties,
                Is.EquivalentTo(
                    new List <string>
            {
                "ScriptLanguage",
            }));

            var newDescription = new ScriptDescriptionModel(context.Object, Core.Host.Scripting.ScriptLanguage.IronRuby);

            model.ScriptLanguage = newDescription;

            Assert.AreEqual(1, propertyChangedWasRaised);
        }