public void Equality() { // Arrange var dataAttribute = entity.FindAttribute("Name"); var mapped1 = new MappedDataAttribute { Attribute = dataAttribute }; var mapped2 = new MappedDataAttribute { Attribute = dataAttribute }; // Act and assert mapped1.Equals(mapped2).Should().BeTrue(); }
public void CanLoadAttribute() { // Arrange var attribute = new MappedDataAttribute { XPath = "Person/@Name" }; var attributes = new[] { attribute }; var content = "<Person Name=\"Fred\"></Person>"; // Act loader.LoadExamples(ModelId, content, attributes, ExampleId); // Assert attribute.Examples.Should().HaveCount(1); }
public void MissingNodeIsHandled() { // Arrange var attribute = new MappedDataAttribute { XPath = "Person/Name" }; var attributes = new[] { attribute }; var content = "<Person></Person>"; // Act loader.LoadExamples(ModelId, content, attributes, ExampleId); // Assert attribute.Examples.Should().HaveCount(0); }
public void CanLoadOneExample(string content, string desired) { // Arrange var attribute = new MappedDataAttribute { XPath = "Person/Name" }; var attributes = new[] { attribute }; // Act loader.LoadExamples(ModelId, content, attributes, ExampleId); // Assert attribute.Examples.Should().HaveCount(1); attribute.Examples[ExampleId].Should().Contain(desired); }
private bool BelongsToModel(MappedDataAttribute attribute, string modelId) { return(attribute.Attribute.Parent.Parent.Id == modelId); }
// TODO - would it be better to break these into multiple classes with a base interface/class? public MappedDataArgument(MappedDataAttribute attribute) { Attribute = attribute; }