protected override void OnSetup()
		{
			base.OnSetup();
			_transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
			_generals = new[]
				{
					new GeneralDTO {ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1},
					new GeneralDTO {ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1},
					new GeneralDTO {ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 2},
				};

			_assignables = new[]
				{
					new AssignableDTO {ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID},
					new AssignableDTO {ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID},
					new AssignableDTO {ID = 4, EntityStateID = 12, SquadID = 11, ProjectID = 2, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID}
				};

			_transport.On<GeneralQuery>().Reply(x => ReplyOnEntityQuery<GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));

			_transport.On<AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables));
			
			_transport.On<CommentQuery>().Reply(x => new CommentQueryResult{Dtos = new CommentDTO[]{}, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0});

			_transport.On<TestStepQuery>().Reply(x => new TestStepQueryResult { Dtos = new TestStepDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });

		}
        protected override void OnSetup()
        {
            base.OnSetup();
            _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
            _generals  = new[]
            {
                new GeneralDTO {
                    ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1
                },
            };

            _comments = new[]
            {
                new CommentDTO {
                    GeneralID = 2, CommentID = 1, Description = "FirstDescription"
                },
            };

            _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));
            _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, new AssignableDTO[] {}));
            _transport.On <TestCaseQuery>().Reply(x => new TestCaseQueryResult {
                Dtos = new TestCaseDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });
            _transport.On <ImpedimentQuery>().Reply(x => new ImpedimentQueryResult {
                Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });
            _transport.On <CommentQuery>().Reply(x => ReplyOnEntityQuery <CommentQuery, CommentDTO, CommentQueryResult>(x, _comments));
        }
        protected override void OnSetup()
        {
            base.OnSetup();
            _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
            _generals = new[]
                {
                    new GeneralDTO {ID = 1, Name = "First general", EntityTypeID = 4, ParentProjectID = 1},
                    new GeneralDTO {ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1},
                    new GeneralDTO {ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1},
                    new GeneralDTO {ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.TESTCASE_TYPE_ID, ParentProjectID = 1}
                };

            _comments = new[]
                {
                    new CommentDTO {GeneralID = 1, CommentID = 1, Description = "FirstDescription"},
                    new CommentDTO {GeneralID = 2, CommentID = 2, Description = "SecondDescription"}
                };

            _assignables = new[]
                {
                    new AssignableDTO {ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID},
                    new AssignableDTO {ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID}
                };
            _testCases = new[] { new TestCaseDTO { ID = 4, Success = "Success step", Steps = "Steps", ProjectID = 1, EntityTypeID=QueryEntityTypeProvider.TESTCASE_TYPE_ID } };

            _transport.On<GeneralQuery>().Reply(x => ReplyOnEntityQuery<GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));
            _transport.On<CommentQuery>().Reply(x => ReplyOnEntityQuery<CommentQuery, CommentDTO, CommentQueryResult>(x, _comments));
            _transport.On<TestCaseQuery>().Reply(x => ReplyOnEntityQuery<TestCaseQuery, TestCaseDTO, TestCaseQueryResult>(x, _testCases));
            _transport.On<ImpedimentQuery>().Reply(x => new ImpedimentQueryResult { Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
            _transport.On<AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables));
        }
		protected override void OnSetup()
		{
			base.OnSetup();
			_transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
			_assignables = new[]
			{
				new AssignableDTO {ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ProjectID = 1, SquadID = 1, },
				new AssignableDTO {ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ProjectID = 1, SquadID = 1},
			};
			var generals = _assignables.Select(a => new GeneralDTO {ID = a.ID, Name = a.Name, EntityTypeID = a.EntityTypeID, ParentProjectID = a.ProjectID}).ToArray();

			_comments = new[]
			{
				new CommentDTO {GeneralID = 2, CommentID = 1, Description = "FirstDescription"},
			};

			_assignableSquads = new[]
			{
				new AssignableSquadDTO { AssignableSquadID = 1, AssignableID = 2, SquadID = 1}
			};

			_transport.On<GeneralQuery>().Reply(x => ReplyOnEntityQuery<GeneralQuery, GeneralDTO, GeneralQueryResult>(x, generals));
			_transport.On<AssignableQuery>().Reply(x => ReplyOnEntityQuery<AssignableQuery, AssignableDTO, AssignableQueryResult>(x, _assignables));
			_transport.On<ImpedimentQuery>().Reply(x => new ImpedimentQueryResult { Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
			_transport.On<ReleaseProjectQuery>().Reply(x => new ReleaseProjectQueryResult { Dtos = new ReleaseProjectDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
			_transport.On<RetrieveAllAssignableSquadsQuery>().Reply(x => ReplyOnEntityQuery<RetrieveAllAssignableSquadsQuery, AssignableSquadDTO, AssignableSquadQueryResult>(x, _assignableSquads));
			_transport.On<CommentQuery>().Reply(x => ReplyOnEntityQuery<CommentQuery, CommentDTO, CommentQueryResult>(x, _comments));
			_transport.On<TestStepQuery>().Reply(x => ReplyOnEntityQuery<TestStepQuery, TestStepDTO, TestStepQueryResult>(x, new TestStepDTO[0]));
		}
		protected override void OnSetup()
		{
			base.OnSetup();
			_transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
			_generals = new[]
				{
					new GeneralDTO {ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1},
					new GeneralDTO {ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1},
					new GeneralDTO {ID = 7, Name = "First Test Case", EntityTypeID = QueryEntityTypeProvider.TESTCASE_TYPE_ID, ParentProjectID = 1}
				};

			_comments = new[]
				{
					new CommentDTO {GeneralID = 2, CommentID = 1, Description = "FirstDescription"},
				};

			_testSteps = new[]
			{
				new TestStepDTO
				{
					ID = 2,
					Description = "First Test Step Description",
					Result = "First Test Step Result",
					TestCaseID = 7
				}
			};

			_transport.On<GeneralQuery>().Reply(x => ReplyOnEntityQuery<GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));
			_transport.On<AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, new AssignableDTO[]{}));
			_transport.On<ImpedimentQuery>().Reply(x => new ImpedimentQueryResult { Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
			_transport.On<ReleaseProjectQuery>().Reply(x => new ReleaseProjectQueryResult { Dtos = new ReleaseProjectDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
			_transport.On<RetrieveAllAssignableSquadsQuery>().Reply(x => new AssignableSquadQueryResult { Dtos = new AssignableSquadDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0 });
			_transport.On<CommentQuery>().Reply(x => ReplyOnEntityQuery<CommentQuery, CommentDTO, CommentQueryResult>(x, _comments));
			_transport.On<TestStepQuery>().Reply(x => ReplyOnEntityQuery<TestStepQuery, TestStepDTO, TestStepQueryResult>(x, _testSteps));
		}
        public void ShouldAutoreplyOnAMessage()
        {
            //Pre-Conditions
            _transport.On <RequestCreatedMessage>().Reply(
                incomingMessage => new ReplyMessage());

            //Action

            var tpBus  = ObjectFactory.GetInstance <ITpBus>();
            var sagaId = Guid.NewGuid();

            tpBus.SetOutSagaId(sagaId);
            tpBus.Send(new RequestCreatedMessage());
            _transport.RaiseTransportMessageReceived();

            //Post-Conditions
            _handled.Should(Be.True);
            _replyMessage.SagaId.Should(Be.EqualTo(sagaId));
        }
        protected override void OnSetup()
        {
            base.OnSetup();
            _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
            _generals  = new[]
            {
                new GeneralDTO {
                    ID = 2, Name = "Second general", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 3, Name = "Third general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 2
                },
            };

            _assignables = new[]
            {
                new AssignableDTO {
                    ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID
                },
                new AssignableDTO {
                    ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID
                },
                new AssignableDTO {
                    ID = 4, EntityStateID = 12, SquadID = 11, ProjectID = 2, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID
                }
            };

            _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));

            _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables));

            _transport.On <CommentQuery>().Reply(x => new CommentQueryResult {
                Dtos = new CommentDTO[] {}, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });

            _transport.On <TestStepQuery>().Reply(x => new TestStepQueryResult {
                Dtos = new TestStepDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });
        }
 public void Reply(Func <CreateCommand, ISagaMessage> message)
 {
     _message = message;
     _transport.On <CreateCommand>(x => _dtoType.IsAssignableFrom(x.Dto.GetType())).Reply(x => _message(x));
 }
        protected override void OnSetup()
        {
            base.OnSetup();
            _transport = TransportMock.CreateWithoutStructureMapClear(typeof(SearcherProfile).Assembly, new[] { typeof(SearcherProfile).Assembly }, new Assembly[] { });
            _generals  = new[]
            {
                new GeneralDTO {
                    ID = 1, Name = "First general assignable", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 2, Name = "Second general assignable", EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 3, Name = "Third general assignable", EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID, ParentProjectID = 1
                },
                new GeneralDTO {
                    ID = 4, Name = "Fourth general", EntityTypeID = QueryEntityTypeProvider.TESTCASE_TYPE_ID, ParentProjectID = 1
                }
            };

            _comments = new[]
            {
                new CommentDTO {
                    GeneralID = 1, CommentID = 1, Description = "FirstDescription"
                },
                new CommentDTO {
                    GeneralID = 2, CommentID = 2, Description = "SecondDescription"
                }
            };

            _assignables = new[]
            {
                new AssignableDTO {
                    ID = 2, EntityStateID = 11, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID
                },
                new AssignableDTO {
                    ID = 3, EntityStateID = 12, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID
                }
            };

            _testSteps = new[]
            {
                new TestStepDTO {
                    ID = 1, TestCaseID = 4, Description = "First Test Step Description"
                },
                new TestStepDTO {
                    ID = 2, TestCaseID = 4, Result = "Second Test Step Result"
                }
            };

            _transport.On <GeneralQuery>().Reply(x => ReplyOnEntityQuery <GeneralQuery, GeneralDTO, GeneralQueryResult>(x, _generals));
            _transport.On <CommentQuery>().Reply(x => ReplyOnEntityQuery <CommentQuery, CommentDTO, CommentQueryResult>(x, _comments));
            _transport.On <ImpedimentQuery>().Reply(x => new ImpedimentQueryResult {
                Dtos = new ImpedimentDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });
            _transport.On <ReleaseProjectQuery>().Reply(x => new ReleaseProjectQueryResult {
                Dtos = new ReleaseProjectDTO[] { }, QueryResultCount = 0, TotalQueryResultCount = 0, FailedDtosCount = 0
            });
            _transport.On <AssignableQuery>().Reply(x => ReplyOnAssignableQuery(x, _assignables));
            _transport.On <TestStepQuery>().Reply(x => ReplyOnEntityQuery <TestStepQuery, TestStepDTO, TestStepQueryResult>(x, _testSteps));
        }