/// <summary> /// Initializes a new instance of the <see cref="OfferComponentDefinition"/> class. /// </summary> /// <param name="configuration"> /// The configuration. /// </param> public OfferComponentDefinition(OfferComponentConfiguration configuration) { Mandate.ParameterNotNull(configuration, "configuration"); this.OfferSettingsKey = configuration.OfferSettingsKey; this.OfferCode = configuration.OfferCode; this.ComponentKey = configuration.ComponentKey; this.TypeFullName = configuration.TypeFullName; this.ExtendedData = configuration.Values.AsExtendedDataCollection(); }
/// <summary> /// Initializes a new instance of the <see cref="OfferComponentDefinition"/> class. /// </summary> /// <param name="configuration"> /// The configuration. /// </param> public OfferComponentDefinition(OfferComponentConfiguration configuration) { Mandate.ParameterNotNull(configuration, "configuration"); this.OfferSettingsKey = configuration.OfferSettingsKey; this.OfferCode = configuration.OfferCode; this.ComponentKey = configuration.ComponentKey; this.TypeFullName = configuration.TypeFullName; this.ExtendedData = configuration.Values.AsExtendedDataCollection(); }
/// <summary> /// Creates an empty component. /// </summary> /// <param name="type"> /// The type. /// </param> /// <returns> /// The <see cref="OfferComponentDefinition"/>. /// </returns> private OfferComponentDefinition CreateEmptyOfferComponentDefinition(Type type) { var att = type.GetCustomAttribute <OfferComponentAttribute>(false); var configuration = new OfferComponentConfiguration() { TypeFullName = type.FullName, ComponentKey = att.Key, Values = Enumerable.Empty <KeyValuePair <string, string> >() }; return(new OfferComponentDefinition(configuration)); }
public void Can_Resolve_An_OfferComponent_By_Type() { var config = new OfferComponentConfiguration() { ComponentKey = new Guid("A035E592-5D09-40BD-BFF6-73C3A4E9DDA2"), TypeFullName = typeof(OneCouponPerCustomerConstraint).Name, Values = Enumerable.Empty<KeyValuePair<string, string>>() }; var definition = new OfferComponentDefinition(config); var resolved = _resolver.GetOfferComponent<OneCouponPerCustomerConstraint>(definition); Assert.NotNull(resolved); }