public void WhenQueryingForQuestionnareTemplates_ThenProvidesQuestionnaireTemplateResult()
        {
            AsyncResult<IEnumerable<QuestionnaireTemplate>> ar = null;
            QuestionnaireTemplate[] suppliedQuestionnaire = new[] { new QuestionnaireTemplate() };

            var serviceMock = new MockQuestionnaireService();

            serviceMock.HandleBeginGetQuestionnaireTemplates = (r) => ar = r;


            var repository = new QuestionnaireRepository(serviceMock);

            IOperationResult<IEnumerable<QuestionnaireTemplate>> getResult = null;
            repository.GetQuestionnaireTemplatesAsync((result) => getResult = result);

            serviceMock.ProceedGetQuestionnaireTemplates(ar, suppliedQuestionnaire);

            EnqueueConditional(() => getResult != null);
            EnqueueCallback(() =>
            {
                Assert.AreSame(suppliedQuestionnaire.ElementAt(0), getResult.Result.ElementAt(0));
            });

            EnqueueTestComplete();
        }
        public void WhenQueryingForQuestionnaireTemplates_ThenInvokesCallback()
        {
            AsyncResult<IEnumerable<QuestionnaireTemplate>> ar = null;

            var serviceMock = new MockQuestionnaireService();

            serviceMock.HandleBeginGetQuestionnaireTemplates = (r) => ar = r;

            var repository = new QuestionnaireRepository(serviceMock);

            bool calledBack = false;

            repository.GetQuestionnaireTemplatesAsync((result) => { calledBack = true; });

            serviceMock.ProceedGetQuestionnaireTemplates(ar, new[] { new QuestionnaireTemplate() });

            EnqueueConditional(() => calledBack);

            EnqueueCallback(() => { Assert.IsTrue(calledBack); });
            EnqueueTestComplete();
        }