Пример #1
0
        public void OnCommand_ReturnsNull_WhenCommandSaslMechanism()
        {
            var profile = new AzureSaslProfileProxy();

            DescribedList result = profile.CallOnCommand(new SaslMechanisms());

            result.ShouldBeNull();
        }
Пример #2
0
        public void UpgradeTransport_ReturnsTheSameTransportInstance()
        {
            ITransport transport = Substitute.For <ITransport>();
            var        profile   = new AzureSaslProfileProxy();

            ITransport result = profile.CallUpgradeTransport(transport);

            result.ShouldBeSameAs(transport);
        }
Пример #3
0
        public void OnCommand_ReturnsAmqpException_WhenCommandNotSupported()
        {
            var command = new SaslChallenge();
            var profile = new AzureSaslProfileProxy();

            AmqpException exception = Should.Throw <AmqpException>(() => profile.CallOnCommand(command));

            exception.Error.Condition.ShouldBe((Symbol)ErrorCode.NotAllowed);
            exception.Message.ShouldBe(command.ToString());
        }
Пример #4
0
        public void OnCommand_ReturnsSaslOutcomeOk_WhenCommandSaslInit()
        {
            var outcome = default(SaslOutcome);
            var profile = new AzureSaslProfileProxy();

            DescribedList result = profile.CallOnCommand(new SaslInit());

            result.ShouldSatisfyAllConditions(
                () => outcome = result.ShouldBeOfType <SaslOutcome>(),
                () => outcome.Code.ShouldBe(SaslCode.Ok)
                );
        }
Пример #5
0
        public void GetStartCommand_ReturnsSaslInitWithCorrectSettings()
        {
            var saslInit = default(SaslInit);
            var profile  = new AzureSaslProfileProxy();

            DescribedList command = profile.CallGetStartCommand("hostname1");

            command.ShouldSatisfyAllConditions(
                () => saslInit = command.ShouldBeOfType <SaslInit>(),
                () => saslInit.Mechanism.ShouldBe((Symbol)"MSSBCBS"),
                () => saslInit.InitialResponse.ShouldBe(Encoding.UTF8.GetBytes("MSSBCBS"))
                );
        }