public void SingleCodeCoverageMethodWhenOnlySetter() { CodeCoverageProperty property = new CodeCoverageProperty(setter); List<CodeCoverageMethod> expectedMethods = new List<CodeCoverageMethod>(); expectedMethods.Add(setter); Assert.AreEqual(expectedMethods, property.GetMethods()); }
/// <summary> /// Adds a getter or setter to the property. /// </summary> public void AddMethod(CodeCoverageMethod method) { name = GetPropertyName(method); if (CodeCoverageProperty.IsGetter(method)) { getter = method; } else { setter = method; } }
public void SetUpFixture() { properties = new CodeCoveragePropertyCollection(); getterMethod = new CodeCoverageMethod("get_Count", "MyTests", MethodAttributes.SpecialName); setterMethod = new CodeCoverageMethod("set_Count", "MyTests", MethodAttributes.SpecialName); properties.Add(getterMethod); properties.Add(setterMethod); if (properties.Count > 0) { property = properties[0]; } }
public void SetUpFixture() { properties = new CodeCoveragePropertyCollection(); XElement getterElement = CreatePropertyGetter("MyTests", "Count"); getterMethod = new CodeCoverageMethod("MyTests", getterElement); XElement setterElement = CreatePropertySetter("MyTests", "Count"); setterMethod = new CodeCoverageMethod("MyTests", setterElement); properties.Add(getterMethod); properties.Add(setterMethod); if (properties.Count > 0) { property = properties[0]; } }
/// <summary> /// Adds a getter or setter to the properties collection. /// </summary> public void Add(CodeCoverageMethod method) { bool added = false; string propertyName = CodeCoverageProperty.GetPropertyName(method); foreach (CodeCoverageProperty property in properties) { if (propertyName == property.Name) { property.AddMethod(method); added = true; } } if (!added) { properties.Add(new CodeCoverageProperty(method)); } }
public CodeCoveragePropertyTreeNode(CodeCoverageProperty property) : base(property.Name, property.GetMethods(), CodeCoverageImageListIndex.Property) { this.property = property; }
public void PropertyNameFromSetter() { CodeCoverageProperty property = new CodeCoverageProperty(setter); Assert.AreEqual("Count", property.Name); }
public void TwoCodeCoverageMethodsWhenSetterAndGetterAdded() { CodeCoverageProperty property = new CodeCoverageProperty(getter); property.AddMethod(setter); List<CodeCoverageMethod> expectedMethods = new List<CodeCoverageMethod>(); expectedMethods.Add(getter); expectedMethods.Add(setter); Assert.AreEqual(expectedMethods, property.GetMethods()); }