コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }