public void TestBuilderCannotBeReused() { var builder = new CustomInputs.Builder { { "string", "test" } }; builder.Build(); Assert.Throws <InvalidOperationException>(() => builder.Add("nope", true)); Assert.Throws <InvalidOperationException>(() => builder.Build()); Assert.Throws <InvalidOperationException>(() => builder.GetEnumerator()); }
public void TestJson() { var inputs = new CustomInputs.Builder { { "string_input_1", "test string" }, { "int_input", 19 }, { "long_input", 12L }, { "float_input", 3.2f }, { "double_input", 32.123d }, { "bool_input", true } }.Build(); Assert.Equal( new JObject { { "string_input_1", "test string" }, { "int_input", 19 }, { "long_input", 12L }, { "float_input", 3.2f }, { "double_input", 32.123d }, { "bool_input", true } }, JToken.FromObject(inputs)); }