public void CreateAndGetPropertyValue_ExampleStringProperty_ExampleStringPropertyValue() { string propertyName = "Example property name"; string propertyValue = "Example proprty value"; var infoOutputProperty = new InfoOutputProperty(propertyName, propertyValue); Assert.That(infoOutputProperty.Value, Is.EqualTo(propertyValue)); }
/// <summary>Gets a specific <see cref="InfoOutputProperty"/> object which represents the value of a property with respect to <see cref="GeneralPropertyGroupName"/>. /// </summary> /// <param name="propertyName">The name of the general property.</param> /// <param name="value">The general property (output).</param> /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns> public bool TryGetGeneralProperty(IdentifierString propertyName, out InfoOutputProperty value) { if (propertyName != null) { return(m_GeneralProperties.TryGetValue(propertyName, out value)); } value = default; return(false); }
/// <summary>Gets a specific <see cref="InfoOutputProperty"/> object with repsect to a specific property group name. /// </summary> /// <param name="propertyName">The name of the property.</param> /// <param name="value">The property (output).</param> /// <param name="propertyGroupName">The name of the property group (i.e. 'General Properties' etc.).</param> /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns> public bool TryGetProperty(string propertyName, out InfoOutputProperty value, IdentifierString propertyGroupName) { if (propertyGroupName != null) { if (m_Properties.TryGetValue(propertyGroupName, out IdentifierStringDictionaryBase <InfoOutputProperty> propertyCollection) == true) { return(propertyCollection.TryGetValue(propertyName, out value)); } } value = default; return(false); }
public void GeneralProperties_IdentifierStringProperty_TheProperty() { string propertyName = "Day count convention"; object propertyValue = IdentifierString.Create("30/360"); m_InfoOutputPackage.Add(propertyName, propertyValue); m_InfoOutputPackage.Add("A second property name", "Second property value"); // add a second property InfoOutputProperty expectedInfoOutputProperty = new InfoOutputProperty("day Count convention", propertyValue); var actualInfoOutputProperty = m_InfoOutputPackage.GeneralProperties[propertyName]; Assert.That(actualInfoOutputProperty, PropertyNameValuePair.Matches(expectedInfoOutputProperty)); }
public void GeneralProperties_DoublePropertyName_TheProperty() { string propertyName = "Time to expiry"; object propertyValue = 42.0; m_InfoOutputPackage.Add(propertyName, propertyValue); m_InfoOutputPackage.Add("A second property name", "Second property value"); // add a second property InfoOutputProperty expectedInfoOutputProperty = new InfoOutputProperty("time To Expiry", 42.0); var actualInfoOutputProperty = m_InfoOutputPackage.GeneralProperties[propertyName]; Assert.That(actualInfoOutputProperty, PropertyNameValuePair.Matches(expectedInfoOutputProperty)); }
public void TestPropertyGroup_DoublePropertyName_TheProperty() { string propertyGroupName = "TestPropertyGroup"; string propertyName = "Time to expiry"; object propertyValue = 42.0; // here, we add a second property m_InfoOutputPackage.Add(propertyGroupName, InfoOutputProperty.Create(propertyName, propertyValue), InfoOutputProperty.Create("A second property name", "Second property value")); InfoOutputProperty expectedInfoOutputProperty = new InfoOutputProperty("time To Expiry", 42.0); var actualInfoOutputProperty = m_InfoOutputPackage.GetProperty(propertyName, propertyGroupName); Assert.That(actualInfoOutputProperty, PropertyNameValuePair.Matches(expectedInfoOutputProperty)); }
public void CreateAndGetPropertyValue_ObjectProperty_PropertyValue(string propertyName, object propertyValue) { var infoOutputProperty = new InfoOutputProperty(propertyName, propertyValue); Assert.That(infoOutputProperty.Value, Is.SameAs(propertyValue)); }
/// <summary>Adds a specific property to the current instance with respect to <see cref="GeneralPropertyGroupName"/>. /// </summary> /// <param name="generalPropertyName">The name of the general property.</param> /// <param name="generalPropertyValue">The value of the general property.</param> /// <param name="annotation">A description of the property.</param> public void Add(string generalPropertyName, object generalPropertyValue, string annotation) { InfoOutputProperty property = new InfoOutputProperty(generalPropertyName, generalPropertyValue, annotation); m_GeneralProperties.Add(property.Name, property); }
/// <summary>Initializes a new instance of the <see cref="InfoOutputPropertyIsEqualToConstraint"/> class. /// </summary> /// <param name="expectedInfoOutputProperty">The expected <see cref="InfoOutputProperty"/> object.</param> internal InfoOutputPropertyIsEqualToConstraint(InfoOutputProperty expectedInfoOutputProperty) { m_ExpectedInfoOutputProperty = expectedInfoOutputProperty; }
/// <summary>Test whether a specific <see cref="InfoOutputProperty"/> object equals the actual <see cref="InfoOutputProperty"/> object. /// </summary> /// <param name="expectedInfoOutputProperty">The expected <see cref="InfoOutputProperty"/> object.</param> /// <returns>The constraint of the comparision in its <see cref="Constraint"/> representation.</returns> internal static Constraint Matches(InfoOutputProperty expectedInfoOutputProperty) { return(new InfoOutputPropertyIsEqualToConstraint(expectedInfoOutputProperty)); }