Beispiel #1
0
 public PsaTestRepository(ReadingSource callingSource)
 {
     _settings          = new Settings();
     _testResultFactory = new PsaTestResultFactory();
     _testResultSynchronizationService = new PsaTestResultSynchronizationService(callingSource, _settings.CaptureBloodTest);
     _callingSource = callingSource;
 }
Beispiel #2
0
 public AAATestRepository(IPersistenceLayer persistenceLayer, ITestResultFactory testResultFactory, ITestResultSynchronizationService testResultSynchronizationService)
     : base(persistenceLayer)
 {
     _testResultFactory = testResultFactory;
     _testResultSynchronizationService = testResultSynchronizationService;
     _callingSource = ReadingSource.Manual;
 }
Beispiel #3
0
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter,
                            SpecFlowConfiguration specFlowConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
                            IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker, IObsoleteStepHandler obsoleteStepHandler, ICucumberMessageSender cucumberMessageSender, ITestResultFactory testResultFactory,
                            ITestPendingMessageFactory testPendingMessageFactory, ITestUndefinedMessageFactory testUndefinedMessageFactory,
                            ITestObjectResolver testObjectResolver = null, IObjectContainer testThreadContainer = null) //TODO: find a better way to access the container
 {
     _errorProvider           = errorProvider;
     _bindingInvoker          = bindingInvoker;
     _contextManager          = contextManager;
     _unitTestRuntimeProvider = unitTestRuntimeProvider;
     _bindingRegistry         = bindingRegistry;
     _specFlowConfiguration   = specFlowConfiguration;
     _testTracer                  = testTracer;
     _stepFormatter               = stepFormatter;
     _stepArgumentTypeConverter   = stepArgumentTypeConverter;
     _stepErrorHandlers           = stepErrorHandlers?.Values.ToArray();
     _stepDefinitionMatchService  = stepDefinitionMatchService;
     _testObjectResolver          = testObjectResolver;
     TestThreadContainer          = testThreadContainer;
     _obsoleteStepHandler         = obsoleteStepHandler;
     _cucumberMessageSender       = cucumberMessageSender;
     _testResultFactory           = testResultFactory;
     _testPendingMessageFactory   = testPendingMessageFactory;
     _testUndefinedMessageFactory = testUndefinedMessageFactory;
 }
Beispiel #4
0
        public override bool SaveTestResults(TestResult currentTestResult, long customerId, long eventId, long orgRoleUserId)
        {
            var customer = new CustomerRepository().GetCustomer(customerId);

            _testResultFactory = new HemoglobinTestResultFactory(customer.Gender != Gender.Female);
            TestResult synchronizedTestResult = null;

            if (currentTestResult.IsNewResultFlow)
            {
                if (SaveNewTestResult(currentTestResult, customerId, eventId, ref synchronizedTestResult))
                {
                    return(true);
                }
            }
            else
            {
                if (SaveOldTestResult(currentTestResult, customerId, eventId, ref synchronizedTestResult))
                {
                    return(true);
                }
            }


            var customerEventScreeningEntity =
                _testResultFactory.CreateTestResultEntity(synchronizedTestResult, GetListOfTestReadingAndReadingId((int)TestType.Hemoglobin));

            using (var scope = new TransactionScope())
            {
                var result = PersistTestResults(customerEventScreeningEntity, (int)TestType.Hemoglobin, customerId, eventId, orgRoleUserId);
                scope.Complete();
                return(result);
            }
        }
Beispiel #5
0
        static ITestResultMethod runMethodTest(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            TestMethod testMethod,
            Action <IDrawingTarget> action)
        {
            var attribute = testMethod.Attribute;

            var width  = attribute.Width;
            var height = attribute.Height;

            using (var target = drawingBackend.CreateBitmapDrawingSurface(width, height))
            {
                ITestResultReport testReport;
                using (var drawingTarget = target.BeginDraw())
                {
                    action(drawingTarget);
                    testReport = resultFactory.Report(drawingTarget.Reports);
                }

                var bitmap = resultFactory.Bitmap(width, height, target.ExtractRawBitmap());

                return(resultFactory.Method(testMethod.Info.Name, bitmap, testReport));
            }
        }
Beispiel #6
0
        public ITestResultClass[] run(ITestResultFactory resultFactory, IDrawingBackend drawingBackend, Assembly assembly)
        {
            var results = new List <ITestResultClass>();

            foreach (var type in assembly.GetTypes())
            {
                try
                {
                    var testable = getTestableMethodsForType(type).ToArray();

                    if (testable.Length == 0)
                    {
                        continue;
                    }

                    var methods = runClassTest(resultFactory, drawingBackend, type, testable);
                    results.Add(resultFactory.Class(type.Namespace, type.Name, methods));
                }
                catch (Exception e)
                {
                    results.Add(resultFactory.Class(type.Namespace, type.Name, e));
                }
            }

            return(results.ToArray());
        }
        public ITestResultAssembly run(ITestResultFactory resultFactory, string testAssemblyPath, Assembly testAssembly)
        {
            // http://blogs.msdn.com/b/suzcook/archive/2003/05/29/choosing-a-binding-context.aspx#57147
            // LoadFrom differs from Load in that dependent assemblies can be resolved outside from the
            // BasePath.

            try
            {
                var drawingBackendType = tryLocateDrawingBackend(testAssembly);
                if (drawingBackendType == null)
                    throw new Exception("Missing [DrawingBackend] attribute. Please add [assembly:DrawingBackend] to your test assembly.");

                using (var drawingBackend = (IDrawingBackend)Activator.CreateInstance(drawingBackendType))
                {
                    TimeSpan time;
                    var classes = Measure.RunningTime(out time,
                        () => run(resultFactory, drawingBackend, testAssembly));
                    return resultFactory.Assembly(testAssemblyPath, classes, time);
                }
            }
            catch (Exception e)
            {
                return resultFactory.Assembly(testAssemblyPath, e);
            }
        }
Beispiel #8
0
        static ITestResultMethod[] runMethodTests(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            object instance,
            IEnumerable <TestMethod> methods)
        {
            var results = new List <ITestResultMethod>();

            foreach (var method in methods)
            {
                var info = method.Info;

                try
                {
                    string whyNot;
                    if (!method.canTest(out whyNot))
                    {
                        if (!method.Ignorable)
                        {
                            throw new Exception(whyNot);
                        }
                        continue;
                    }

                    var methodResult = runMethodTest(resultFactory, drawingBackend, instance, method);
                    results.Add(methodResult);
                }
                catch (Exception e)
                {
                    results.Add(resultFactory.Method(info.Name, e));
                }
            }

            return(results.ToArray());
        }
Beispiel #9
0
        static ITestResultMethod[] runClassTest(ITestResultFactory resultFactory, IDrawingBackend drawingBackend, Type type, IEnumerable <TestMethod> methods)
        {
            var constructor = type.GetConstructor(new Type[0]);

            if (constructor == null)
            {
                throw new Exception("No constructor found for {0}".format(type));
            }

            var instance = constructor.Invoke(null);

            try
            {
                return(runMethodTests(resultFactory, drawingBackend, instance, methods));
            }
            finally
            {
                var disposable = instance as IDisposable;
                if (disposable != null)
                {
                    try
                    {
                        disposable.Dispose();
                    }
                    catch
                    {
                        // and where to put this result, should we tamper with the method results or even
                        // invalidate all?
                    }
                }
            }
        }
Beispiel #10
0
        public ITestResultAssembly run(ITestResultFactory resultFactory, string testAssemblyPath, Assembly testAssembly)
        {
            // http://blogs.msdn.com/b/suzcook/archive/2003/05/29/choosing-a-binding-context.aspx#57147
            // LoadFrom differs from Load in that dependent assemblies can be resolved outside from the
            // BasePath.

            try
            {
                var drawingBackendType = tryLocateDrawingBackend(testAssembly);
                if (drawingBackendType == null)
                {
                    throw new Exception("Missing [DrawingBackend] attribute. Please add [assembly:DrawingBackend] to your test assembly.");
                }

                using (var drawingBackend = (IDrawingBackend)Activator.CreateInstance(drawingBackendType))
                {
                    TimeSpan time;
                    var      classes = Measure.RunningTime(out time,
                                                           () => run(resultFactory, drawingBackend, testAssembly));
                    return(resultFactory.Assembly(testAssemblyPath, classes, time));
                }
            }
            catch (Exception e)
            {
                return(resultFactory.Assembly(testAssemblyPath, e));
            }
        }
Beispiel #11
0
 public CsTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new CsTestResultFactory(true);
     _testResultSynchronizationService  = new CsTestResultSynchronizationService(callingSource);
     _testPerformedExternallyRepository = new TestPerformedExternallyRepository();
     _testPerformedExternallyFactory    = new TestPerformedExternallyFactory();
     _callingSource = callingSource;
 }
Beispiel #12
0
 static ITestResultMethod runDrawingTargetTest(
     ITestResultFactory resultFactory,
     IDrawingBackend drawingBackend,
     object instance,
     TestMethod testMethod)
 {
     return(runMethodTest(resultFactory, drawingBackend, testMethod, drawingTarget => testMethod.invoke(instance, drawingTarget, drawingBackend)));
 }
        public GallioAdapter()
        {
            LoaderManager.InitializeAndSetupRuntimeIfNeeded();

            testIdProperty = TestProperty.Register("Gallio.TestId", "Test id", typeof(string), typeof(TestCase));

            testCaseFactory = new TestCaseFactory(testIdProperty);
            cachingTestCaseFactory = new CachingTestCaseFactory(testCaseFactory, testIdProperty);
            testResultFactory = new TestResultFactory();

            testExplorer = new TestExplorer(cachingTestCaseFactory);
            testRunner = new TestRunner(cachingTestCaseFactory, testResultFactory, testIdProperty);
        }
Beispiel #14
0
        public GallioAdapter()
        {
            LoaderManager.InitializeAndSetupRuntimeIfNeeded();

            testIdProperty = TestProperty.Register("Gallio.TestId", "Test id", typeof(string), typeof(TestCase));

            testCaseFactory        = new TestCaseFactory(testIdProperty);
            cachingTestCaseFactory = new CachingTestCaseFactory(testCaseFactory, testIdProperty);
            testResultFactory      = new TestResultFactory();

            testExplorer = new TestExplorer(cachingTestCaseFactory);
            testRunner   = new TestRunner(cachingTestCaseFactory, testResultFactory, testIdProperty);
        }
Beispiel #15
0
 public TestExecutionEngine(
     IStepFormatter stepFormatter,
     ITestTracer testTracer,
     IErrorProvider errorProvider,
     IStepArgumentTypeConverter stepArgumentTypeConverter,
     SpecFlowConfiguration specFlowConfiguration,
     IBindingRegistry bindingRegistry,
     IUnitTestRuntimeProvider unitTestRuntimeProvider,
     IContextManager contextManager,
     IStepDefinitionMatchService stepDefinitionMatchService,
     IBindingInvoker bindingInvoker,
     IObsoleteStepHandler obsoleteStepHandler,
     ICucumberMessageSender cucumberMessageSender,
     ITestResultFactory testResultFactory,
     ITestPendingMessageFactory testPendingMessageFactory,
     ITestUndefinedMessageFactory testUndefinedMessageFactory,
     ITestRunResultCollector testRunResultCollector,
     IAnalyticsEventProvider analyticsEventProvider,
     IAnalyticsTransmitter analyticsTransmitter,
     ITestRunnerManager testRunnerManager,
     IRuntimePluginTestExecutionLifecycleEventEmitter runtimePluginTestExecutionLifecycleEventEmitter,
     ITestThreadExecutionEventPublisher testThreadExecutionEventPublisher,
     ITestObjectResolver testObjectResolver = null,
     IObjectContainer testThreadContainer   = null) //TODO: find a better way to access the container
 {
     _errorProvider           = errorProvider;
     _bindingInvoker          = bindingInvoker;
     _contextManager          = contextManager;
     _unitTestRuntimeProvider = unitTestRuntimeProvider;
     _bindingRegistry         = bindingRegistry;
     _specFlowConfiguration   = specFlowConfiguration;
     _testTracer                  = testTracer;
     _stepFormatter               = stepFormatter;
     _stepArgumentTypeConverter   = stepArgumentTypeConverter;
     _stepDefinitionMatchService  = stepDefinitionMatchService;
     _testObjectResolver          = testObjectResolver;
     TestThreadContainer          = testThreadContainer;
     _obsoleteStepHandler         = obsoleteStepHandler;
     _cucumberMessageSender       = cucumberMessageSender;
     _testResultFactory           = testResultFactory;
     _testPendingMessageFactory   = testPendingMessageFactory;
     _testUndefinedMessageFactory = testUndefinedMessageFactory;
     _testRunResultCollector      = testRunResultCollector;
     _analyticsEventProvider      = analyticsEventProvider;
     _analyticsTransmitter        = analyticsTransmitter;
     _testRunnerManager           = testRunnerManager;
     _runtimePluginTestExecutionLifecycleEventEmitter = runtimePluginTestExecutionLifecycleEventEmitter;
     _testThreadExecutionEventPublisher = testThreadExecutionEventPublisher;
 }
Beispiel #16
0
 static ITestResultMethod runGeometryTargetTest(
     ITestResultFactory resultFactory,
     IDrawingBackend drawingBackend,
     object instance,
     TestMethod testMethod)
 {
     using (var geometry = drawingBackend.Geometry(target => testMethod.invoke(instance, target, drawingBackend)))
     {
         return(runMethodTest(resultFactory, drawingBackend, testMethod, dt =>
         {
             dt.Fill(color: new Color(0.7, 0.7, 1.0));
             dt.Geometry(geometry);
         }));
     }
 }
Beispiel #17
0
        public override TestResult GetTestResults(long customerId, long eventId, bool isNewResultFlow)
        {
            var customer = new CustomerRepository().GetCustomer(customerId);

            _testResultFactory = new HemoglobinTestResultFactory(customer.Gender != Gender.Female);
            List <CustomerEventScreeningTestsEntity> customerEventScreeningTests = GetTestResultsByTestId(customerId, eventId, (int)TestType.Hemoglobin);

            var testResult = _testResultFactory.CreateTestResults(customerEventScreeningTests).SingleOrDefault();

            if (testResult != null)
            {
                testResult.IsNewResultFlow = isNewResultFlow;
            }

            return(testResult);
        }
        public override TestResult GetTestResults(long customerId, long eventId, bool isNewResultFlow)
        {
            var customer = new CustomerRepository().GetCustomer(customerId);

            _testResultFactory = new DiabetesTestResultFactory(customer.Gender == Gender.Female ? false : true);
            List <CustomerEventScreeningTestsEntity> customerEventScreeningTests = GetTestResultsByTestId(customerId, eventId, (int)TestType.Diabetes);

            var testResult = _testResultFactory.CreateTestResults(customerEventScreeningTests).SingleOrDefault();

            if (testResult == null)
            {
                return(null);
            }
            testResult.IsNewResultFlow = isNewResultFlow;
            return(testResult);
        }
Beispiel #19
0
 public GhprTestExecutionEngine(
     IStepFormatter stepFormatter,
     ITestTracer testTracer,
     IErrorProvider errorProvider,
     IStepArgumentTypeConverter stepArgumentTypeConverter,
     SpecFlowConfiguration specFlowConfiguration,
     IBindingRegistry bindingRegistry,
     IUnitTestRuntimeProvider unitTestRuntimeProvider,
     IContextManager contextManager,
     IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary <string, IStepErrorHandler> stepErrorHandlers,
     IBindingInvoker bindingInvoker,
     IObsoleteStepHandler obsoleteStepHandler,
     ICucumberMessageSender cucumberMessageSender,
     ITestResultFactory testResultFactory,
     ITestPendingMessageFactory testPendingMessageFactory,
     ITestUndefinedMessageFactory testUndefinedMessageFactory,
     ITestRunResultCollector testRunResultCollector,
     IAnalyticsEventProvider analyticsEventProvider,
     IAnalyticsTransmitter analyticsTransmitter,
     ITestRunnerManager testRunnerManager,
     ITestObjectResolver testObjectResolver = null,
     IObjectContainer testThreadContainer   = null)
 {
     _engine = new TestExecutionEngine(stepFormatter,
                                       testTracer,
                                       errorProvider,
                                       stepArgumentTypeConverter,
                                       specFlowConfiguration,
                                       bindingRegistry,
                                       unitTestRuntimeProvider,
                                       contextManager,
                                       stepDefinitionMatchService,
                                       stepErrorHandlers,
                                       bindingInvoker,
                                       obsoleteStepHandler,
                                       cucumberMessageSender,
                                       testResultFactory,
                                       testPendingMessageFactory,
                                       testUndefinedMessageFactory,
                                       testRunResultCollector,
                                       analyticsEventProvider,
                                       analyticsTransmitter,
                                       testRunnerManager,
                                       testObjectResolver,
                                       testThreadContainer);
 }
Beispiel #20
0
        public override bool SaveTestResults(TestResult currentTestResult, long customerId, long eventId, long orgRoleUserId)
        {
            var customer = new CustomerRepository().GetCustomer(customerId);

            _testResultFactory = new CsTestResultFactory(customer.Gender == Gender.Female ? false : true);
            TestResult synchronizedTestResult = null;

            if (currentTestResult.IsNewResultFlow)
            {
                if (SaveNewTestResult(currentTestResult, customerId, eventId, ref synchronizedTestResult))
                {
                    return(true);
                }
            }
            else
            {
                if (SaveOldTestResult(currentTestResult, customerId, eventId, ref synchronizedTestResult))
                {
                    return(true);
                }
            }

            var customerEventScreeningEntity = _testResultFactory.CreateTestResultEntity(synchronizedTestResult, GetListOfTestReadingAndReadingId((int)TestType.Cs));

            using (var scope = new TransactionScope())
            {
                var result = PersistTestResults(customerEventScreeningEntity, (int)TestType.Cs, customerId, eventId, orgRoleUserId);

                var eventCustomerResultRepository = new EventCustomerResultRepository();
                var eventCustomerResult           = eventCustomerResultRepository.GetByCustomerIdAndEventId(customerId, eventId);

                var customerEventScreeningTestId = GetCustomerEventScreeningTestId((int)TestType.Cs, eventCustomerResult.Id);


                var resultMedia = new List <ResultMedia>();
                if (((CsTestResult)synchronizedTestResult).ResultImage != null)
                {
                    resultMedia.Add(((CsTestResult)synchronizedTestResult).ResultImage);
                }

                SaveTestMedia(resultMedia, customerEventScreeningTestId, synchronizedTestResult.DataRecorderMetaData);

                scope.Complete();
                return(result);
            }
        }
Beispiel #21
0
        static ITestResultMethod runMethodTest(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            object instance,
            TestMethod testMethod)
        {
            var firstParameterType = testMethod.FirstParamterType;

            if (firstParameterType.IsAssignableFrom(typeof(IDrawingTarget)))
            {
                return(runDrawingTargetTest(resultFactory, drawingBackend, instance, testMethod));
            }

            if (firstParameterType.IsAssignableFrom(typeof(IGeometryTarget)))
            {
                return(runGeometryTargetTest(resultFactory, drawingBackend, instance, testMethod));
            }

            throw new Exception("Unable to decide what test to run based on first parameter type {0}\nShould be either IDrawingTarget or IGeometryTarget".format(firstParameterType));
        }
Beispiel #22
0
        public override TestResult GetTestResults(long customerId, long eventId, bool isNewResultFlow)
        {
            var customer = new CustomerRepository().GetCustomer(customerId);

            _testResultFactory = new FocTestResultFactory(customer.Gender == Gender.Female ? false : true);
            List <CustomerEventScreeningTestsEntity> customerEventScreeningTests = GetTestResultsByTestId(customerId, eventId, (int)TestType.Foc);

            var testResult = _testResultFactory.CreateTestResults(customerEventScreeningTests).SingleOrDefault();

            if (testResult == null)
            {
                return(null);
            }

            var focTestResult = (FocTestResult)testResult;

            if (focTestResult.ResultImage != null)
            {
                GetFileDataforResultmedia(focTestResult.ResultImage);
            }
            testResult.IsNewResultFlow = isNewResultFlow;
            return(testResult);
        }
        public ITestResultClass[] run(ITestResultFactory resultFactory, IDrawingBackend drawingBackend, Assembly assembly)
        {
            var results = new List<ITestResultClass>();

            foreach (var type in assembly.GetTypes())
            {
                try
                {
                    var testable = getTestableMethodsForType(type).ToArray();

                    if (testable.Length == 0)
                        continue;

                    var methods = runClassTest(resultFactory, drawingBackend, type, testable);
                    results.Add(resultFactory.Class(type.Namespace, type.Name, methods));
                }
                catch (Exception e)
                {
                    results.Add(resultFactory.Class(type.Namespace, type.Name, e));
                }
            }

            return results.ToArray();
        }
        static ITestResultMethod runMethodTest(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            object instance,
            TestMethod testMethod)
        {
            var firstParameterType = testMethod.FirstParamterType;
            if (firstParameterType.IsAssignableFrom(typeof(IDrawingTarget)))
            {
                return runDrawingTargetTest(resultFactory, drawingBackend, instance, testMethod);
            }

            if (firstParameterType.IsAssignableFrom(typeof(IGeometryTarget)))
            {
                return runGeometryTargetTest(resultFactory, drawingBackend, instance, testMethod);
            }

            throw new Exception("Unable to decide what test to run based on first parameter type {0}\nShould be either IDrawingTarget or IGeometryTarget".format(firstParameterType));
        }
 static ITestResultMethod runGeometryTargetTest(
     ITestResultFactory resultFactory,
     IDrawingBackend drawingBackend,
     object instance,
     TestMethod testMethod)
 {
     using (var geometry = drawingBackend.Geometry(target => testMethod.invoke(instance, target, drawingBackend)))
     {
         return runMethodTest(resultFactory, drawingBackend, testMethod, dt =>
             {
                 dt.Fill(color: new Color(0.7, 0.7, 1.0));
                 dt.Geometry(geometry);
             });
     }
 }
 static ITestResultMethod runDrawingTargetTest(
     ITestResultFactory resultFactory,
     IDrawingBackend drawingBackend,
     object instance,
     TestMethod testMethod)
 {
     return runMethodTest(resultFactory, drawingBackend, testMethod, drawingTarget => testMethod.invoke(instance, drawingTarget, drawingBackend));
 }
Beispiel #27
0
 public VSTestWindowExtension(ITestExecutionRecorder executionRecorder, ITestCaseFactory testCaseFactory, ITestResultFactory testResultFactory)
 {
     this.executionRecorder = executionRecorder;
     this.testCaseFactory   = testCaseFactory;
     this.testResultFactory = testResultFactory;
 }
 public QuantaFloABITestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new QuantaFloABITestResultFactory();
     _testResultSynchronizationService = new QuantaFloABITestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
Beispiel #29
0
 public DiabetesFootExamTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new DiabetesFootExamTestResultFactory();
     _testResultSynchronizationService = new DiabetesFootExamTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
 public WomenBloodPanelTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new WomenBloodPanelTestResultFactory();
     _testResultSynchronizationService = new WomenBloodPanelTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
Beispiel #31
0
 public PulmonaryFunctionTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new PulmonaryFunctionTestResultFactory();
     _testResultSynchronizationService = new PulmonaryTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
 public TestRunner(ITestCaseFactory testCaseFactory, ITestResultFactory testResultFactory, TestProperty testIdProperty)
 {
     this.testCaseFactory   = testCaseFactory;
     this.testResultFactory = testResultFactory;
     this.testIdProperty    = testIdProperty;
 }
Beispiel #33
0
 public HemoglobinTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new HemoglobinTestResultFactory(true);
     _testResultSynchronizationService = new HemoglobinTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
Beispiel #34
0
 public FraminghamRiskTestResultRepository(ReadingSource callingSource)
 {
     _testResultFactory = new FraminghamRiskTestResultFactory();
     _testResultSynchronizationService = new FraminghamRiskTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
        static ITestResultMethod runMethodTest(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            TestMethod testMethod,
            Action<IDrawingTarget> action)
        {
            var attribute = testMethod.Attribute;

            var width = attribute.Width;
            var height = attribute.Height;

            using (var target = drawingBackend.CreateBitmapDrawingSurface(width, height))
            {
                ITestResultReport testReport;
                using (var drawingTarget = target.BeginDraw())
                {
                    action(drawingTarget);
                    testReport = resultFactory.Report(drawingTarget.Reports);
                }

                var bitmap = resultFactory.Bitmap(width, height, target.ExtractRawBitmap());

                return resultFactory.Method(testMethod.Info.Name, bitmap, testReport);
            }
        }
        static ITestResultMethod[] runMethodTests(
            ITestResultFactory resultFactory,
            IDrawingBackend drawingBackend,
            object instance,
            IEnumerable<TestMethod> methods)
        {
            var results = new List<ITestResultMethod>();
            foreach (var method in methods)
            {
                var info = method.Info;

                try
                {
                    string whyNot;
                    if (!method.canTest(out whyNot))
                    {
                        if (!method.Ignorable)
                            throw new Exception(whyNot);
                        continue;
                    }

                    var methodResult = runMethodTest(resultFactory, drawingBackend, instance, method);
                    results.Add(methodResult);
                }
                catch (Exception e)
                {
                    results.Add(resultFactory.Method(info.Name, e));
                }
            }

            return results.ToArray();
        }
Beispiel #37
0
 public AAATestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new AaaTestResultFactory();
     _testResultSynchronizationService = new AaaTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
        static ITestResultMethod[] runClassTest(ITestResultFactory resultFactory, IDrawingBackend drawingBackend, Type type, IEnumerable<TestMethod> methods)
        {
            var constructor = type.GetConstructor(new Type[0]);
            if (constructor == null)
                throw new Exception("No constructor found for {0}".format(type));

            var instance = constructor.Invoke(null);

            try
            {
                return runMethodTests(resultFactory, drawingBackend, instance, methods);
            }
            finally
            {
                var disposable = instance as IDisposable;
                if (disposable != null)
                {
                    try
                    {
                        disposable.Dispose();
                    }
                    catch
                    {
                        // and where to put this result, should we tamper with the method results or even
                        // invalidate all?
                    }
                }
            }
        }
 public TestRunner(ITestCaseFactory testCaseFactory, ITestResultFactory testResultFactory, TestProperty testIdProperty)
 {
     this.testCaseFactory = testCaseFactory;
     this.testResultFactory = testResultFactory;
     this.testIdProperty = testIdProperty;
 }
Beispiel #40
0
 public HypertensionTestRepository(ReadingSource callingSource)
 {
     _testResultFactory = new HypertensionTestResultFactory();
     _testResultSynchronizationService = new HypertensionTestResultSynchronizationService(callingSource);
     _callingSource = callingSource;
 }
 public VSTestWindowExtension(ITestExecutionRecorder executionRecorder, ITestCaseFactory testCaseFactory, ITestResultFactory testResultFactory)
 {
     this.executionRecorder = executionRecorder;
     this.testCaseFactory = testCaseFactory;
     this.testResultFactory = testResultFactory;
 }