public void ParseFunctions_ParseSetting_ThrowsOnNullParseContext() { // Arrange ParseContext nullParseContext = null; Task next() => Task.CompletedTask; // Act ParseFunctions.ParseSetting(nullParseContext, next).Wait(); }
public void ParseFunctions_ParseSetting_ThrowsOnNullNextFunction() { // Arrange var reader = new StreamReader(new MemoryStream()); var state = new object(); var context = new ParseContext(reader, state); Func <Task> nullNextFunction = null; // Act ParseFunctions.ParseSetting(context, nullNextFunction).Wait(); }
public void ParseFunctions_ParseSetting_ThrowsWhenInputContainsAnWhiteSpaceValue() { // Arrange var reader = new StreamReader(new MemoryStream()); var state = new ParseSetting_TestState(); var context = new ParseContext(reader, state) { Input = "SettingField1: \t " }; Task next() => Task.CompletedTask; // Act ParseFunctions.ParseSetting(context, next); }
public void ParseFunctions_ParseSetting_FailsWhenInputDoesNotContainANameAndValue() { // Arrange var reader = new StreamReader(new MemoryStream()); var state = new ParseSetting_TestState(); var context = new ParseContext(reader, state) { Input = "SettingField1 Lorem ipsum" }; Task next() => Task.CompletedTask; // Act ParseFunctions.ParseSetting(context, next); }
public void ParseFunctions_ParseSetting_SetsFieldValueOnStateObject() { // Arrange var reader = new StreamReader(new MemoryStream()); var state = new ParseSetting_TestState(); var context = new ParseContext(reader, state) { Input = "SettingField1: Lorem ipsum: dolor" }; Task next() => Task.CompletedTask; // Act ParseFunctions.ParseSetting(context, next); // Assert Assert.AreEqual("Lorem ipsum: dolor", state.SettingField1); }