public void IndexOfFindsTemplate() { var collection = new TemplateParameterCollection(); var param = new TemplateParameter("test", "string", ""); collection.Add(param); Assert.AreEqual(0, collection.IndexOf(param)); }
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 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 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 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 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 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 AddWithNullRegexMatchThrowsArgumentNullException() { var collection = new TemplateParameterCollection(); UnitTestHelper.AssertThrowsArgumentNullException(() => collection.Add((Match)null)); }