예제 #1
0
        public void TryToGetResultFromStringArrayThrowsForUnhandledResultType()
        {
            var testResult             = new TestResult(TimeSpan.FromSeconds(30));
            var targetAlgorithmFactory =
                new DummyTargetAlgorithmFactory <DummyTargetAlgorithm <TestInstance, TestResult>, TestInstance, TestResult>() as
                ITargetAlgorithmFactory <DummyTargetAlgorithm <TestInstance, TestResult>, TestInstance, TestResult>;

            Assert.Throws <NotImplementedException>(
                () => targetAlgorithmFactory.TryToGetResultFromStringArray(testResult.ToStringArray(), out var result));
        }
예제 #2
0
        public void TryToGetResultFromStringArrayWorksForRuntimeResults()
        {
            var runtimeResult          = new RuntimeResult(TimeSpan.FromSeconds(30));
            var targetAlgorithmFactory =
                new DummyTargetAlgorithmFactory <DummyTargetAlgorithm <TestInstance, RuntimeResult>, TestInstance, RuntimeResult>() as
                ITargetAlgorithmFactory <DummyTargetAlgorithm <TestInstance, RuntimeResult>, TestInstance, RuntimeResult>;

            targetAlgorithmFactory.TryToGetResultFromStringArray(runtimeResult.ToStringArray(), out var result).ShouldBeTrue();
            result.TargetAlgorithmStatus.ShouldBe(runtimeResult.TargetAlgorithmStatus);
            result.IsCancelled.ShouldBe(runtimeResult.IsCancelled);
            result.Runtime.ShouldBe(runtimeResult.Runtime);
        }