Beispiel #1
0
        public async Task InitalResponseIsntServiceReadyReturnsFalse()
        {
            A.CallTo(() => _smtpDeserializer.Deserialize(A <IStreamReader> ._)).Returns(
                Task.FromResult(new SmtpResponse(new List <Response> {
                _unknownReponse
            })));

            StartTlsResult result = await _smtpClient.TryStartTls(Stream.Null);

            Assert.That(result.Success, Is.False);
        }
Beispiel #2
0
        public async Task ElhoResponseDoesntContainStartTlsReturnsFalse()
        {
            A.CallTo(() => _smtpDeserializer.Deserialize(A <IStreamReader> ._)).ReturnsNextFromSequence(
                Task.FromResult(new SmtpResponse(new List <Response> {
                _serviceReadyReponse
            })),
                Task.FromResult(new SmtpResponse(new List <Response> {
                _unknownReponse
            })));

            StartTlsResult result = await _smtpClient.TryStartTls(Stream.Null);

            Assert.That(result.Success, Is.False);
        }
Beispiel #3
0
        public async Task StartTlsSuccessfulReturnsTrue()
        {
            A.CallTo(() => _smtpDeserializer.Deserialize(A <IStreamReader> ._)).ReturnsNextFromSequence(
                Task.FromResult(new SmtpResponse(new List <Response> {
                _serviceReadyReponse
            })),
                Task.FromResult(new SmtpResponse(new List <Response> {
                _startTlsResponse
            })),
                Task.FromResult(new SmtpResponse(new List <Response> {
                _serviceReadyReponse
            })));

            StartTlsResult result = await _smtpClient.TryStartTls(Stream.Null);

            Assert.That(result.Success, Is.True);
        }