public void CanClearCollection() { var collection = new TemplateParameterCollection {new TemplateParameter("name", "string", "0")}; Assert.AreEqual(1, collection.Count); collection.Clear(); Assert.AreEqual(0, collection.Count); }
public void IndexOfFindsTemplate() { var collection = new TemplateParameterCollection(); var param = new TemplateParameter("test", "string", ""); collection.Add(param); Assert.AreEqual(0, collection.IndexOf(param)); }
public void CanClearCollection() { var collection = new TemplateParameterCollection { new TemplateParameter("name", "string", "0") }; Assert.AreEqual(1, collection.Count); collection.Clear(); Assert.AreEqual(0, collection.Count); }
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); }
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 TemplateParameterCollectionDoesNotStoreDuplicateParameters() { var collection = new TemplateParameterCollection { new TemplateParameter("MyTest", "int", 0.ToString()) }; Assert.AreEqual(1, collection.Count, "Our one parameter is in there."); collection.Add(new TemplateParameter("MyTest", "nvarchar(32)", "Blah")); Assert.AreEqual(1, collection.Count, "Should only be one parameter still."); }
public void TestParseSimpleScripts(string scriptText, string name, string dataType, string defaultValue) { var script = new Script(scriptText); TemplateParameterCollection parameters = script.TemplateParameters; Assert.AreEqual(1, parameters.Count, "Expected one parameter."); TemplateParameter parameter = parameters[0]; Assert.AreEqual(name, parameter.Name, "Parameter name was not parsed correctly."); Assert.AreEqual(dataType, parameter.DataType, "Data Type was not parsed correctly."); Assert.AreEqual(defaultValue, parameter.Value, "DefaultValue was not parsed correctly."); }
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 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 AddWithNullTemplateParameterThrowsArgumentNullException() { var collection = new TemplateParameterCollection(); UnitTestHelper.AssertThrowsArgumentNullException(() => collection.Add((TemplateParameter)null)); }
public void TemplateParameterCollectionDoesNotStoreDuplicateParameters() { var collection = new TemplateParameterCollection {new TemplateParameter("MyTest", "int", 0.ToString())}; Assert.AreEqual(1, collection.Count, "Our one parameter is in there."); collection.Add(new TemplateParameter("MyTest", "nvarchar(32)", "Blah")); Assert.AreEqual(1, collection.Count, "Should only be one parameter still."); }
public void IsReadOnlyReturnsFalse() { var collection = new TemplateParameterCollection(); Assert.IsFalse(collection.IsReadOnly); }
public void AddWithNullRegexMatchThrowsArgumentNullException() { var collection = new TemplateParameterCollection(); UnitTestHelper.AssertThrowsArgumentNullException(() => collection.Add((Match)null)); }