public void ContainsReturnsCorrectParameter()
        {
            var collection = new TemplateParameterCollection();
            Assert.IsFalse(collection.Contains("test"), "An empty collection should not contain a parameter.");
            var parameter = new TemplateParameter("test", "type", "something");
            Assert.IsFalse(collection.Contains(parameter), "An empty collection should not contain a parameter.");

            collection.Add(parameter);
            Assert.IsTrue(collection.Contains(parameter));
            Assert.IsTrue(collection.Contains("test"));

            var differentParameter = new TemplateParameter("differentName", "", "");
            Assert.IsFalse(collection.Contains(differentParameter), "Contains should not be a \"yes\" method.");
            Assert.IsFalse(collection.Contains(differentParameter.Name), "Contains should not be a \"yes\" method.");

            var newParameterWithSameName = new TemplateParameter("test", "type", "something");
            Assert.IsTrue(collection.Contains(newParameterWithSameName),
                          "Even though this is a separate instance, we match parameters by name. So we should already contain this one.");
        }
 public void IndexOfFindsTemplate()
 {
     var collection = new TemplateParameterCollection();
     var param = new TemplateParameter("test", "string", "");
     collection.Add(param);
     Assert.AreEqual(0, collection.IndexOf(param));
 }
        public void CopyToEmptyArrayLeavesNotEmptyArray()
        {
            var collection = new TemplateParameterCollection {new TemplateParameter("test", "string", "")};

            var parameters = new TemplateParameter[1];
            collection.CopyTo(parameters, 0);
            Assert.AreEqual("test", parameters[0].Name);
        }
 public void RemoveRemovesTemplate()
 {
     var collection = new TemplateParameterCollection();
     var param = new TemplateParameter("test", "string", "");
     collection.Add(param);
     Assert.AreEqual(1, collection.Count);
     collection.Remove(param);
     Assert.AreEqual(0, collection.Count);
 }
Пример #5
0
 internal TemplateParameterToken(TemplateParameter parameter)
 {
     _parameter = parameter;
 }
Пример #6
0
 internal void Append(TemplateParameter parameter)
 {
     Last.Next = new TemplateParameterToken(parameter);
 }
Пример #7
0
 internal TemplateParameterToken(TemplateParameter parameter)
 {
     _parameter = parameter;
 }
Пример #8
0
 internal void Append(TemplateParameter parameter)
 {
     Last.Next = new TemplateParameterToken(parameter);
 }