protected void SaveJsonState(string name, IJsonConvertible state) { var json = new JsonContext().ToJson(state); using (var sw = new StringWriter()) { JsonValue.WriteMin(json, sw); State[name] = sw.GetStringBuilder().ToString(); } }
public ActionCollectionTest() { _fixture = new Fixture(); _jsonConvertible = Substitute.For <IJsonConvertible>(); _schemaValidation = Substitute.For <IJsonSchemaValidation>(); _convertible = Substitute.For <Mozilla.IoT.WebThing.Convertibles.IConvertible>(); _factory = Substitute.For <IActionInformationFactory>(); _collection = new ActionCollection(_jsonConvertible, _schemaValidation, _convertible, _factory); }
/// <summary> /// Initialize a new instance of <see cref="ActionCollection"/>. /// </summary> /// <param name="inputConvertible">The <see cref="IJsonConvertible"/>.</param> /// <param name="inputValidation"></param> /// <param name="actionInformationFactory">The <see cref="IActionInformationFactory"/>.</param> /// <param name="convertible"></param> public ActionCollection(IJsonConvertible inputConvertible, IJsonSchemaValidation inputValidation, IConvertible convertible, IActionInformationFactory actionInformationFactory) { _actionInformationFactory = actionInformationFactory ?? throw new ArgumentNullException(nameof(actionInformationFactory)); _convertible = convertible ?? throw new ArgumentNullException(nameof(convertible)); _inputValidation = inputValidation ?? throw new ArgumentNullException(nameof(inputValidation)); _inputConvertible = inputConvertible ?? throw new ArgumentNullException(nameof(inputConvertible)); _actions = new ConcurrentDictionary <Guid, ThingActionInformation>(); }
public ThingPropertyTest() { _fixture = new Fixture(); _thing = new FakeThing(); _jsonConvertible = Substitute.For <IJsonConvertible>(); _jsonSchemaValidation = Substitute.For <IJsonSchemaValidation>(); _convertible = Substitute.For <Mozilla.IoT.WebThing.Convertibles.IConvertible>(); _setter = (thing, value) => ((FakeThing)thing).Value = value; _getter = thing => ((FakeThing)thing).Value; _originPropertyName = _fixture.Create <string>(); }
/// <summary> /// Initialize a new instance of <see cref="SystemTexJsonArrayConvertible"/>. /// </summary> /// <param name="convertible">The <see cref="IJsonConvertible"/>.</param> public SystemTexJsonArrayConvertible(IJsonConvertible convertible) { _convertible = convertible ?? throw new ArgumentNullException(nameof(convertible)); }
/// <summary> /// Initialize a new instance of <see cref="NewtonsoftArrayConvertible"/>. /// </summary> /// <param name="convertible">The <see cref="IJsonConvertible"/>.</param> public NewtonsoftArrayConvertible(IJsonConvertible convertible) { _convertible = convertible ?? throw new ArgumentNullException(nameof(convertible)); }