Exemple #1
0
        public void ParseSubjectFromDataSection_ShouldParseSubjectFromDataSection()
        {
            //arrange
            var headers = new NameValueCollection();

            headers.Add("Subject", "Subject of this letter");

            //act
            var result = _emailParser.ParseSubjectFromDataSection(headers);

            //assert
            result.Should().Be("Subject of this letter");
        }
        public void Run_ShoulSetSubject()
        {
            //arrange
            var readLine      = "not empty string";
            var parsedSubject = "parsedSubjectString";

            _clientController.Read().Returns(readLine, readLine, readLine, _mailDataSection);
            _requestCommandsConverter.ToRequestCommandCode(Arg.Any <string>()).Returns(
                RequestCommands.Hello,
                RequestCommands.RcptTo,
                RequestCommands.Data,
                RequestCommands.Quit);

            _serverStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.SrvReady, _hostName).Returns("response1");
            _serverStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.SrvHelloNoTls, _hostName).Returns("response2");
            _serverStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.StrtInputEndWith).Returns("response3");
            _serverStatusCodesConverter.GetTextResponseForStatus(ResponseCodes.RqstActOkCompleted).Returns("response4");
            _emailParser.ParseSubjectFromDataSection(Arg.Any <NameValueCollection>()).Returns(parsedSubject);

            //act
            var message = _clientProcessor.Run();

            //assert
            message.Subject.Should().Be(parsedSubject);
        }