public void Setup()
        {

            Test.Initialize();


            _now = DateTime.Now;

            _submitForApprovalMessage = new SubmitForApproval
                        {
                            ApprovedBy = "GH13579",
                            ApprovedOn = _now,
                            DataCollectionId = 1
                        };

            _submitForSecondaryApprovalMessage = new SubmitForSecondaryApproval
                        {
                            DataCollectionId = 1,
                            ApprovedBy = "FH13545",
                            ApprovedOn = _submitForApprovalMessage.ApprovedOn.AddDays(1)
                        };

            _submitForFinalApprovalMessage = new SubmitForFinalApproval
                        {
                            DataCollectionId = 1,
                            ApprovedBy = "787878r",
                            ApprovedOn = _submitForSecondaryApprovalMessage.ApprovedOn.AddDays(1)
                        };

            _submitForSecondaryReApprovalMessage = new SubmitForSecondaryReApproval
            {
                DataCollectionId = 1,
                ApprovedBy = "454545k",
                ApprovedOn = _submitForFinalApprovalMessage.ApprovedOn.AddDays(1)
            };


            _publishDataCollectionMessage = new PublishDataCollection
                                                {
                                                    DataCollectionId = 1,
                                                    ApprovedBy = "321312w",
                                                    ApprovedOn = _submitForFinalApprovalMessage.ApprovedOn.AddDays(2)
                                                };

            _exportToVivoResponse = new ExportToVivoResponse
                                        {
                                            DataCollectionId = 1
                                        };

        }
        public void Send_PublishDataCollection_command_to_bus_for_a_secondary_approved_data_collection_once_publication_approved()
        {
            // QA Approver actions to publish the data collection
            var dataCollection = CreateDataCollectionWithState(DataCollectionStatus.SecondaryApproved);
            var vm = Builder<ApprovalConfirmationViewModel>.CreateNew()
                .With(m => m.DataCollectionId = dataCollection.Id)
                .And(m => m.State = DataCollectionStatus.SecondaryApproved)
                .And(m => m.IsPublicationApproved = true)
                .Build();
            var hashCode = new DataCollectionHashCode();
            hashCode.UpdateHashCode(dataCollection);
            CreateQaUser();

            _dataCollectionRepository.Get(dataCollection.Id).Returns(dataCollection);
            _hashCodeRepository.GetByDataCollectionId(dataCollection.Id).Returns(hashCode);

            _bus.When(c => c.Send(Arg.Any<Action<PublishDataCollection>>())).Do(a =>
            {
                var rsc = new PublishDataCollection();
                var lambda = a.Arg<Action<PublishDataCollection>>();

                lambda(rsc);

                Assert.That(rsc.DataCollectionId, Is.EqualTo(dataCollection.Id), "Invalid data collection id passed to the bus");
                Assert.That(rsc.ApprovedOn, Is.EqualTo(dataCollection.CurrentState.StateChangedOn).Within(1).Minutes, "Invalid approval date passed to the bus");
                Assert.That(rsc.ApprovedBy, Is.EqualTo(QaId), "Invalid approver id passed to the bus");
            });

            _controller.WithCallTo(c => c.Confirm(vm)).ShouldRenderView("Approved")
                .WithModel<ApprovalConfirmationViewModel>(m => m.ProposedState == DataCollectionStatus.Publishing);
        }