public ResponseType Send(SubmitLrap1AttachmentCommand submission)
        {
            if (string.IsNullOrEmpty(submission.AttachmentId))
            {
                throw new ArgumentException("Missing AttachmentId");
            }

            if (string.IsNullOrEmpty(submission.ApplicationId))
            {
                throw new ArgumentException("Missing ApplicationId");
            }

            if (string.IsNullOrEmpty(submission.Username))
            {
                throw new ArgumentException("Missing Username");
            }

            if (string.IsNullOrEmpty(submission.Password))
            {
                throw new ArgumentException("Missing Password");
            }

            return _edrsCommunicator.Submit(new Lrap1AttachmentRequest()
            {
                AttachmentId = submission.AttachmentId,
                Username = submission.Username,
                Password = submission.Password,
                ApplicationId = submission.ApplicationId,
                Payload = submission.Payload
            }).ResponseType;
        }
 public When_a_Lrap1Attachment_is_sent()
 {
     _fakeEdrsCommunicator = A.Fake<IEdrsCommunicator>();
     _sut = new CommsService(_fakeEdrsCommunicator);
     _lrap1AttachmentSubmission = new SubmitLrap1AttachmentCommand()
     {
         AttachmentId = "9876543210",
         ApplicationId = "1234567890",
         Username = "******",
         Password = "******",
         Payload = "Attachment Payload Data"
     };
 }
        public When_the_messaging_service_processes_an_LRAP1Attachment_submission()
        {
            //Arrange
            _fakeCommsService = A.Fake<ICommsService>();
            _fakeMessageSender = A.Fake<ISendMessages>();

            _sut = new Lrap1Processor(_fakeMessageSender, _fakeCommsService);

            _command = new SubmitLrap1AttachmentCommand()
            {
                AttachmentId = "9876543210",
                ApplicationId = "123456789",
                Username = "******",
                Password = "******",
                Payload = "Payload"
            };
        }
        public void the_submission_service_processes_the_message()
        {
            //Arrange
            var command = new SubmitLrap1AttachmentCommand()
            {
                AttachmentId = "9876543210",
                ApplicationId = "1234567890",
                Username = "******",
                Password = "******",
                Payload = "payload"
            };

            var fakeMessageProcessor = A.Fake<IMessageProcessor>();
            var sut = A.Fake<Lrap1Processor>();
            sut.MessageProcessor = fakeMessageProcessor;

            //Act
            sut.Handle(command);

            //Assert
            A.CallTo(() => fakeMessageProcessor.Process(command))
                .MustHaveHappened(Repeated.Exactly.Once);
        }
 public void Send(SubmitLrap1AttachmentCommand command)
 {
     _bus.Send(command);
 }