Example #1
0
        public void ParseFunctions_ParseSetting_ThrowsOnNullParseContext()
        {
            // Arrange
            ParseContext nullParseContext = null;

            Task next() => Task.CompletedTask;

            // Act
            ParseFunctions.ParseSetting(nullParseContext, next).Wait();
        }
Example #2
0
        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();
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }