Inheritance: MonoBehaviour
		public void TestSelfReferenceAsField()
		{
			var model = new TestModel
			{
				Name = "Parent",
			};

			const String template = "[[this]]";
			const String expected = "TestModelSelf";

			String actual = new TestEngine().Process(template, model);
			Assert.AreEqual(expected, actual);
		}
		public void TestSelfReferenceInSubTemplate()
		{
			var model = new TestModel{Name = "Test"};

			const String template = @""
				+ "Model: [[Name]]"
				+ "Subtemplate [[template(SUB, this)]]";

			const String expected = @""
				+ "Model: Test"
				+ "Subtemplate SUB: Test";

			String actual = new TestEngine().Process(template, model);
			Assert.AreEqual(expected, actual);
		}
		public void TestSelfReferenceInLoop()
		{
			var model = new TestModel[]
			{
				new TestModel { Name = "1" },
				new TestModel { Name = "2" },
			};

			const String template = @""
				+ "[[ for(this) ]]"
				+ "[[this.Name]]"
				+ "[[ endfor(this) ]]";

			const String expected = "12";

			String actual = new TestEngine().Process(template, model);
			Assert.AreEqual(expected, actual);
		}
Example #4
0
        public UIElement StartRun()
        {
            Server.Debug("XUnit: EntryPointAssembly = {0}".FormatWith(_loadedXapData.EntryPointAssembly));

            // We're not using UnitDriven't TestEngine to execute the tests
            // it doesn't provide an easy way for us to filter specific tests
            // so we're manually creating test commands.
            // The only purpose for the TestEngine is to do the original reflection to find what tests to run
            // and to provide the UI...

            var testEngine = new TestEngine(_loadedXapData.EntryPointAssembly);

            Application.Current.RootVisual = testEngine;
            _dispatcher = Application.Current.RootVisual.Dispatcher;

            WireUpTestEngineMonitoring(testEngine.Context);

            return testEngine;
        }
		public void TestSubTemplate()
		{
			var model = new
			{
				Name = "Parent",
				Child = new { Name = "Uudu" },
				AnotherChild = new { Name = "Aadu" }
			};

			const String template = @""
				+ "[[Name]]"
				+ "[[template(MY, Child)]]"
				+ "[[template(ANOTHER, AnotherChild)]]";

			const String expected = @""
				+ "Parent"
				+ "Subtemplate MY: Uudu"
				+ "Subtemplate ANOTHER: Aadu";

			String actual = new TestEngine().Process(template, model);
			Assert.AreEqual(expected, actual);
		}
 public void Init()
 {
     snapshot   = new TestDataCache();
     testengine = new TestEngine(snapshot: snapshot);
     testengine.AddEntryScript("./TestClasses/Contract_Delegate.cs");
 }
 /// <summary>
 /// Default constructor.
 /// Initializes all class-wide test-dependent members.
 /// </summary>
 public BubbleSortTests()
 {
     this.testDriver = new TestEngine(TEST_BREADTH, TEST_DEPTH);
     this.bubbleSort = new BubbleSort();
 }
        public void TestSerializingToByteArrayNewEnginesRoot()
        {
            var init = _entityFactory.BuildEntity <SerializableEntityDescriptor>(0, NamedGroup1.Group);

            init.Init(new EntityStructSerialized()
            {
                value = 5
            });
            init.Init(new EntityStructSerialized2()
            {
                value = 4
            });
            init.Init(new EntityStructPartiallySerialized()
            {
                value1 = 3
            });
            init = _entityFactory.BuildEntity <SerializableEntityDescriptor>(1, NamedGroup1.Group);
            init.Init(new EntityStructSerialized()
            {
                value = 4
            });
            init.Init(new EntityStructSerialized2()
            {
                value = 3
            });
            init.Init(new EntityStructPartiallySerialized()
            {
                value1 = 2
            });

            _simpleSubmissionEntityViewScheduler.SubmitEntities();

            var generateEntitySerializer = _enginesRoot.GenerateEntitySerializer();
            var simpleSerializationData  = new SimpleSerializationData(new FasterList <byte>());

            generateEntitySerializer.SerializeEntity(new EGID(0, NamedGroup1.Group), simpleSerializationData
                                                     , (int)SerializationType.Storage);
            generateEntitySerializer.SerializeEntity(new EGID(1, NamedGroup1.Group), simpleSerializationData
                                                     , (int)SerializationType.Storage);

            var serializerSubmissionScheduler = new SimpleEntitiesSubmissionScheduler();

            var newEnginesRoot = new EnginesRoot(serializerSubmissionScheduler);

            _neverDoThisIsJustForTheTest = new TestEngine();
            newEnginesRoot.AddEngine(_neverDoThisIsJustForTheTest);

            simpleSerializationData.Reset();
            generateEntitySerializer = newEnginesRoot.GenerateEntitySerializer();

            generateEntitySerializer.DeserializeNewEntity(new EGID(0, NamedGroup1.Group), simpleSerializationData
                                                          , (int)SerializationType.Storage);
            generateEntitySerializer.DeserializeNewEntity(new EGID(1, NamedGroup1.Group), simpleSerializationData
                                                          , (int)SerializationType.Storage);
            serializerSubmissionScheduler.SubmitEntities();

            Assert.That(
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntity <EntityStructSerialized>(0, NamedGroup1.Group).value
                , Is.EqualTo(5));
            Assert.That(
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntity <EntityStructSerialized2>(0, NamedGroup1.Group).value
                , Is.EqualTo(4));
            Assert.That(
                _neverDoThisIsJustForTheTest
                .entitiesDB.QueryEntity <EntityStructPartiallySerialized>(0, NamedGroup1.Group).value1
                , Is.EqualTo(3));

            Assert.That(
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntity <EntityStructSerialized>(1, NamedGroup1.Group).value
                , Is.EqualTo(4));
            Assert.That(
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntity <EntityStructSerialized2>(1, NamedGroup1.Group).value
                , Is.EqualTo(3));
            Assert.That(
                _neverDoThisIsJustForTheTest
                .entitiesDB.QueryEntity <EntityStructPartiallySerialized>(1, NamedGroup1.Group).value1
                , Is.EqualTo(2));

            newEnginesRoot.Dispose();
        }
Example #9
0
        private void executeTests(ITestRunConfiguration configuration, ITestResultCollector collector)
        {
            TestEngine engine = new TestEngine(configuration);

            engine.Execute(collector);
        }
        private void initialize(Func<IProject> getProject)
        {
            if (_project != null)
            {
                Dispose();
            }

            _project = getProject();
            _engine = new TestEngine();
            _engine.StopConditions.TimeoutInSeconds = _project.TimeoutInSeconds;
            _engine.Handle(new ProjectLoaded(_project));
            _engine.UseTeamCityListener();

            _hierarchy = _project.LoadTests();
        }
        public void UInt160_ValidateAddress()
        {
            var address = "NiNmXL8FjEUEs1nfX9uHFBNaenxDHJtmuB".ToScriptHash(ProtocolSettings.Default.AddressVersion);

            using var testengine = new TestEngine();
            testengine.AddEntryScript("./TestClasses/Contract_UIntTypes.cs");

            // True

            var result = testengine.ExecuteTestCaseStandard("validateAddress", address.ToArray());

            Assert.AreEqual(1, result.Count);
            var item = result.Pop();

            Assert.IsTrue(item.GetBoolean());

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", new ByteString(address.ToArray()));
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsTrue(item.GetBoolean());

            // False

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", new byte[1] {
                1
            }.Concat(address.ToArray()).ToArray());
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", BigInteger.One);
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());

            testengine.Reset();
            testengine.ExecuteTestCaseStandard("validateAddress", StackItem.Null);
            Assert.AreEqual(VMState.FAULT, testengine.State);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", new VM.Types.Array());
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", new Struct());
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", new Map());
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard("validateAddress", StackItem.True);
            Assert.AreEqual(1, result.Count);
            item = result.Pop();
            Assert.IsFalse(item.GetBoolean());
        }
Example #12
0
        protected override void Initialize()
        {
            base.Initialize();

            BuildEngines();
            var input = SetupInput();


            List <IImplementor> testEntityImplementors = new List <IImplementor>();

            world = new World(Vector2.Zero);

            var floor = BodyFactory.CreateBody(world);

            var body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(64f), ConvertUnits.ToSimUnits(64f), 1f, Vector2.One, bodyType: BodyType.Dynamic);

            body.Mass = 1f;
            body.SetTransform(Vector2.Zero, 0f);


            var rigidBodyComponent = new RigidBodyComponentImplementor(body);
            var forceComponent     = new PhysicsForceComponent();
            var impulseComponent   = new PhysicsImpulseComponent();
            var torqueComponent    = new PhysicsTorqueComponent();

            testEntityImplementors.Add(rigidBodyComponent);
            testEntityImplementors.Add(forceComponent);
            testEntityImplementors.Add(impulseComponent);
            testEntityImplementors.Add(torqueComponent);

            //add movement driver, the vector value inside
            var movementDriverComponent = new MovementDriverComponent();

            var playerActionSetContext   = new PlayerActionContextComponent();
            var playerActionSetComponent = new PlayerActionSetComponent(input.playerActionSetOne);

            var playerActionLeftStickComponent  = new PlayerTwoAxisActionComponent(input.playerActionSetOne.LeftStick);
            var playerActionRightStickComponent = new PlayerTwoAxisActionComponent(input.playerActionSetOne.RightStick);
            var playerActionOneComponent        = new PlayerActionComponent(input.playerActionSetOne.Action1);
            var playerActionTwoComponent        = new PlayerActionComponent(input.playerActionSetOne.Action2);

            testEntityImplementors.Add(movementDriverComponent);
            testEntityImplementors.Add(playerActionOneComponent);
            testEntityImplementors.Add(playerActionTwoComponent);
            testEntityImplementors.Add(playerActionSetComponent);
            testEntityImplementors.Add(playerActionLeftStickComponent);
            testEntityImplementors.Add(playerActionRightStickComponent);
            testEntityImplementors.Add(playerActionSetContext);


            var Joint = JointFactory.CreateFrictionJoint(world, floor, body);

            Joint.MaxForce  = 80f;
            Joint.MaxTorque = 80f;

            var playerActionLeftStickSequencer = new Sequencer();

            var playerActionLeftStickUpdateEngine = new PlayerActionLeftStickUpdateEngine(playerActionLeftStickSequencer);
            var basicMoveEngine             = new BasicMoveEngine();
            var physicsForceEngine          = new PhysicsForceEngine();
            var movementDriverEngine        = new MovementDriverEngine();
            var playerActionSetUpdateEngine = new PlayerActionSetUpdateEngine();

            var testEngine = new TestEngine();

            playerActionLeftStickSequencer.SetSequence(
                new Steps
            {
                {
                    playerActionLeftStickUpdateEngine,
                    new To
                    {
                        { PlayerActionContext.Roam, new IStep[] { basicMoveEngine } },
                        { PlayerActionContext.UI, new IStep[] { basicMoveEngine } },
                    }
                },
                {
                    basicMoveEngine,
                    new To
                    {
                        new IStep[] { testEngine }
//                            {PlayerActionContext.Roam, new IStep[] {basicMoveEngine}},
//                            {PlayerActionContext.UI, new IStep[] {basicMoveEngine}},
                    }
                }
            }

                );


            gameEnginesRoot.AddEngine(testEngine);
            gameEnginesRoot.AddEngine(basicMoveEngine);
            gameEnginesRoot.AddEngine(physicsForceEngine);

            gameEnginesRoot.AddEngine(movementDriverEngine);
            gameEnginesRoot.AddEngine(playerActionSetUpdateEngine);
            gameEnginesRoot.AddEngine(playerActionLeftStickUpdateEngine);

            gameEngineEntityFactory.BuildEntity <TestEntityDescriptor>(1, testEntityImplementors.ToArray());
        }
        private Engine CreateEngineInstance()
        {
            var engine = new TestEngine(this.mockReader.Object, this.mockWriter.Object, this.mockDataStore.Object);

            return(engine);
        }
 public void Init()
 {
     _engine = new TestEngine();
     _engine.AddEntryScript("./TestClasses/Contract_Enumerator.cs");
 }
Example #15
0
        public static int Main(string[] args)
        {
            AgentId   = new Guid(args[0]);
            AgencyUrl = args[1];

            InternalTraceLevel traceLevel = InternalTraceLevel.Off;

            for (int i = 2; i < args.Length; i++)
            {
                string arg = args[i];

                // NOTE: we can test these strings exactly since
                // they originate from the engine itself.
                if (arg == "--debug-agent")
                {
                    if (!Debugger.IsAttached)
                    {
                        Debugger.Launch();
                    }
                }
                else if (arg.StartsWith("--trace:"))
                {
                    traceLevel = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), arg.Substring(8));
                }
                else if (arg.StartsWith("--pid="))
                {
                    int agencyProcessId = int.Parse(arg.Substring(6));
                    AgencyProcess = Process.GetProcessById(agencyProcessId);
                }
            }

            // Initialize trace so we can see what's happening
            int    pid     = Process.GetCurrentProcess().Id;
            string logname = string.Format(LOG_FILE_FORMAT, pid);

            InternalTrace.Initialize(logname, traceLevel);

            log.Info("Agent process {0} starting", pid);
            log.Info("Running under version {0}, {1}",
                     Environment.Version,
                     RuntimeFramework.CurrentFramework.DisplayName);

            // Restore the COMPLUS_Version env variable if it's been overridden by TestAgency::LaunchAgentProcess
            try
            {
                string cpvOriginal = Environment.GetEnvironmentVariable("TestAgency_COMPLUS_Version_Original");
                if (!string.IsNullOrEmpty(cpvOriginal))
                {
                    log.Debug("Agent process has the COMPLUS_Version environment variable value \"{0}\" overridden with \"{1}\", restoring the original value.", cpvOriginal, Environment.GetEnvironmentVariable("COMPLUS_Version"));
                    Environment.SetEnvironmentVariable("TestAgency_COMPLUS_Version_Original", null, EnvironmentVariableTarget.Process);                     // Erase marker
                    Environment.SetEnvironmentVariable("COMPLUS_Version", (cpvOriginal == "NULL" ? null : cpvOriginal), EnvironmentVariableTarget.Process); // Restore original (which might be n/a)
                }
            }
            catch (Exception ex)
            {
                log.Warning("Failed to restore the COMPLUS_Version variable. " + ex.Message); // Proceed with running tests anyway
            }

            // Create TestEngine - this program is
            // conceptually part of  the engine and
            // can access it's internals as needed.
            TestEngine engine = new TestEngine();

            // TODO: We need to get this from somewhere. Argument?
            engine.InternalTraceLevel = InternalTraceLevel.Debug;

            // Custom Service Initialization
            //log.Info("Adding Services");
            engine.Services.Add(new SettingsService(false));
            engine.Services.Add(new ExtensionService());
            engine.Services.Add(new ProjectService());
            engine.Services.Add(new DomainManager());
            engine.Services.Add(new InProcessTestRunnerFactory());
            engine.Services.Add(new DriverService());

            // Initialize Services
            log.Info("Initializing Services");
            engine.Initialize();

            Channel = ServerUtilities.GetTcpChannel();

            log.Info("Connecting to TestAgency at {0}", AgencyUrl);
            try
            {
                Agency = Activator.GetObject(typeof(ITestAgency), AgencyUrl) as ITestAgency;
            }
            catch (Exception ex)
            {
                log.Error("Unable to connect", ex);
            }

            if (Channel != null)
            {
                log.Info("Starting RemoteTestAgent");
                Agent = new RemoteTestAgent(AgentId, Agency, engine.Services);

                try
                {
                    if (Agent.Start())
                    {
                        WaitForStop();
                    }
                    else
                    {
                        log.Error("Failed to start RemoteTestAgent");
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Exception in RemoteTestAgent", ex);
                }

                //log.Info("Unregistering Channel");
                try
                {
                    ChannelServices.UnregisterChannel(Channel);
                }
                catch (Exception ex)
                {
                    log.Error("ChannelServices.UnregisterChannel threw an exception", ex);
                }
            }

            log.Info("Agent process {0} exiting", Process.GetCurrentProcess().Id);

            return(0);
        }
Example #16
0
        public void Test_Wrong()
        {
            var testengine = new TestEngine();

            Assert.ThrowsException <NotSupportedException>(() => testengine.AddEntryScript("./TestClasses/Contract_WrongEvent.cs"));
        }
Example #17
0
 void e_OnInvalidBinding(object sender, TestEngine.ControllerEventArgs e)
 {
     ErrorInvalidBinding errBind = new ErrorInvalidBinding(e.Controller.FullName, e.Args);
     errorList.Add(errBind);
 }
Example #18
0
        void e_OnResourceLoop(object sender, TestEngine.MethodEventArgs e)
        {
            List<string> loopControllers = new List<string>();
            foreach(ITypeInfo ctrType in e.Controllers)
            {
                loopControllers.Add(ctrType.FullName);
            }

            ErrorResourceLoop errResLoop = new ErrorResourceLoop(e.MethodUrl, loopControllers.ToArray());
            errorList.Add(errResLoop);
        }
Example #19
0
        public string Answer(string userId, string utterance)
        {
            BotContext context = this.GetValidContext(userId);

            bool isSingleContact = this.IsSingleContact(ref utterance);

            if (context == null)
            {
                LUInfo luInfo = Understand(utterance, isSingleContact);
                if (luInfo.GetType() == typeof(TestLUInfo))
                {
                    context = InitTFContext(userId, (TestLUInfo)luInfo);
                }
                else if (luInfo.GetType() == typeof(ExamLUInfo))
                {
                    context = InitESContext(userId, (ExamLUInfo)luInfo);
                }
                else if (luInfo.GetType() == typeof(ScoreLUInfo))
                {
                    context = InitScoreContext(userId, (ScoreLUInfo)luInfo);
                }
                else
                {
                    context = initPSAContext(userId, luInfo);
                }

                cManager.CreateContext(context, userId);
            }
            else
            {
                if (context.type == ContextType.TaskFlowContext && isSingleContact)
                {
                    TaskFlowContext tfContext = (TaskFlowContext)context;
                    context = updateTFContext(ref tfContext, utterance);
                }
                else if (context.type == ContextType.ExamSuitContext && isSingleContact)
                {
                    ExamSuitContext esContext = (ExamSuitContext)context;
                    context = updateESContext(ref esContext, utterance);
                }
                else if (context.type == ContextType.ScoreContext && isSingleContact)
                {
                    ScoreContext scContext = (ScoreContext)context;
                    context = updateSCContext(ref scContext, utterance);
                }
                else
                {
                    LUInfo luInfo = Understand(utterance, isSingleContact);

                    if (context.type == ContextType.PSAContext)
                    {
                        PSAContext psacontext = (PSAContext)context;
                        context = updatePSAContext(ref psacontext, luInfo);
                    }
                    else
                    {
                        return("[Error]: Unknown Context Type.");
                    }
                }
            }

            string answer = null;

            switch (context.type)
            {
            case ContextType.ScoreContext:
                ScoreEngine  engineS   = new ScoreEngine();
                ScoreContext scContext = (ScoreContext)context;

                answer = engineS.Answer(userId, ref scContext);

                if (scContext.IsInTesting)
                {
                    cManager.UpdateContext(scContext, userId);
                }
                else
                {
                    cManager.RemoveContext(userId);
                }
                break;

            case ContextType.PSAContext:
                ChatTableEngine engine     = new ChatTableEngine();
                PSAContext      psacontext = (PSAContext)context;

                answer = engine.Answer(userId, ref psacontext);

                cManager.UpdateContext(psacontext, userId);
                break;

            case ContextType.TaskFlowContext:
                TestEngine      engineT   = new TestEngine();
                TaskFlowContext tfContext = (TaskFlowContext)context;

                answer = engineT.Answer(userId, ref tfContext);

                if (tfContext.IsInTesting)
                {
                    cManager.UpdateContext(tfContext, userId);
                }
                else
                {
                    cManager.RemoveContext(userId);
                }
                break;

            case ContextType.ExamSuitContext:

                ExamSuitContext esContext = (ExamSuitContext)context;
                DICSExamSrv     taskSrv   = new DICSExamSrv();

                string userInput = esContext.UserInput;

                switch (esContext.status)
                {
                case ESStatus.Started:
                    ExamSuitContext cachedContext = this.GetCachedESContext(userId);
                    answer = taskSrv.StartTest(ref esContext, cachedContext);
                    break;

                case ESStatus.Restarted:
                    answer = taskSrv.ContinueOrRefresh(ref esContext, userInput);
                    break;

                case ESStatus.OnGoing:
                    answer = taskSrv.ReceiveUserAnswer(ref esContext, userInput);
                    break;
                }

                if (esContext.status == ESStatus.Finished || esContext.status == ESStatus.Aborded)
                {
                    cManager.RemoveContext(userId);
                }
                else if (esContext.status == ESStatus.Paused)
                {
                    cManager.StoreESContext(esContext, userId);
                    cManager.RemoveContext(userId);
                }
                else
                {
                    cManager.UpdateContext(esContext, userId);
                }

                break;
            }

            return(answer);
        }
        public async Task SimpleFlowchartWorkflow()
        {
            var fc = new Flowchart()
            {
                Id        = "Ref0",
                Variables = new List <IVariable>
                {
                    new Variable()
                    {
                        Name = "X", Dir = VariableDirection.InOut, Type = VariableType.Number
                    },
                },
                Nodes = new List <FlowNode>()
                {
                    new FlowStart()
                    {
                        Id = "Ref1", Next = "Ref2"
                    },
                    new FlowDecision()
                    {
                        Id = "Ref2", Condition = "X > 0", Then = "Ref3"
                    },
                    new FlowActivity()
                    {
                        Id       = "Ref3", Next = "Ref2",
                        Activity = new Code()
                        {
                            Id = "Ref4", Script = "X -= 1"
                        }
                    }
                }
            };

            var ser  = new Serializer(null);
            var json = ser.SerializeActitity(fc, "json");

            var sp  = TestEngine.ServiceProvider();
            var wfs = sp.GetService <IWorkflowStorage>();
            var wfc = sp.GetService <IWorkflowCatalog>();

            await wfc.SaveAsync(new WorkflowDescriptor()
            {
                Id     = "fchart1",
                Body   = json,
                Format = "json"
            });

            var ident = await wfs.PublishAsync(wfc, "fchart1");

            Assert.AreEqual(1, ident.Version);

            ident = await wfs.PublishAsync(wfc, "fchart1");

            Assert.AreEqual(2, ident.Version);

            var wfe  = sp.GetService <IWorkflowEngine>();
            var inst = await wfe.CreateAsync(ident);

            inst = await wfe.RunAsync(inst.Id, new { X = 5 });

            Assert.AreEqual(0, inst.Result.Get <Int32>("x"));
        }
Example #21
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     RootVisual = new TestEngine(Assembly.GetExecutingAssembly());
 }
        public async Task SimpleSequenceWorkflow()
        {
            Sequence s = new Sequence()
            {
                Id        = "Ref0",
                Variables = new List <IVariable>()
                {
                    new Variable()
                    {
                        Name = "x", Dir = VariableDirection.InOut
                    }
                },
                Activities = new List <IActivity>()
                {
                    new Code()
                    {
                        Id = "Ref1", Script = "x += 5"
                    },
                    new Wait()
                    {
                        Id = "Ref2", Bookmark = "Bookmark1"
                    },
                    new Code()
                    {
                        Id = "Ref3", Script = "x += 5"
                    },
                }
            };

            var ser  = new Serializer(null);
            var json = ser.SerializeActitity(s, "json");

            var sp  = TestEngine.ServiceProvider();
            var wfs = sp.GetService <IWorkflowStorage>();
            var wfc = sp.GetService <IWorkflowCatalog>();

            await wfc.SaveAsync(new WorkflowDescriptor()
            {
                Id     = "xxx",
                Body   = "123",
                Format = "json"
            });

            // check for empty storage
            await wfs.PublishAsync(wfc, "xxx");

            await wfc.SaveAsync(new WorkflowDescriptor()
            {
                Id     = "test2",
                Body   = json,
                Format = "json"
            });

            var ident = await wfs.PublishAsync(wfc, "test2");

            Assert.AreEqual(1, ident.Version);

            ident = await wfs.PublishAsync(wfc, "test2");

            Assert.AreEqual(2, ident.Version);

            var wfe  = sp.GetService <IWorkflowEngine>();
            var inst = await wfe.CreateAsync(ident);

            inst = await wfe.RunAsync(inst.Id, new { x = 5 });

            Assert.AreEqual(10, inst.Result.Get <Int32>("x"));

            inst = await wfe.ResumeAsync(inst.Id, "Bookmark1");

            Assert.AreEqual(15, inst.Result.Get <Int32>("x"));
        }
Example #23
0
    // Do not add any additional code to this method
    private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
    {
      // Set the root visual to allow the application to render
      if (RootVisual != RootFrame)
        RootVisual = new TestEngine(Assembly.GetExecutingAssembly());

      // Remove this handler since it is no longer needed
      RootFrame.Navigated -= CompleteInitializePhoneApplication;
    }
 /// <summary>
 /// Default constructor.
 /// Initializes all class-wide test-dependent members.
 /// </summary>
 public MergeSortTests()
 {
     this.testDriver = new TestEngine(TEST_BREADTH, TEST_DEPTH);
     this.mergeSort  = new MergeSort();
 }
Example #25
0
        void e_OnInconsistentResourceType(object sender, TestEngine.MethodResourceEventArgs e)
        {
            List<string> loopValues = new List<string>();
            foreach (ControllerType ctrType in e.Controllers)
            {
                loopValues.Add(ctrType.Type.FullName);
                loopValues.Add(ctrType.GetResourceType(e.ResourceName));
            }

            ErrorInconsResourceType errInconsResType = new ErrorInconsResourceType(e.MethodUrl, e.ResourceName, loopValues.ToArray());
            errorList.Add(errInconsResType);
        }
Example #26
0
 public void Dispose()
 {
     CloseRunner();
     TestEngine?.Dispose();
 }
Example #27
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            lbl_height.Text     = $"{Blockchain.Default.Height}/{Blockchain.Default.HeaderHeight}";
            lbl_count_node.Text = Program.LocalNode.RemoteNodeCount.ToString();
            TimeSpan persistence_span = DateTime.Now - persistence_time;

            if (persistence_span < TimeSpan.Zero)
            {
                persistence_span = TimeSpan.Zero;
            }
            if (persistence_span > Blockchain.TimePerBlock)
            {
                toolStripProgressBar1.Style = ProgressBarStyle.Marquee;
            }
            else
            {
                toolStripProgressBar1.Value = persistence_span.Seconds;
                toolStripProgressBar1.Style = ProgressBarStyle.Blocks;
            }
            if (Program.CurrentWallet != null)
            {
                if (Program.CurrentWallet.WalletHeight <= Blockchain.Default.Height + 1)
                {
                    if (balance_changed)
                    {
                        IEnumerable <Coin> coins             = Program.CurrentWallet?.GetCoins().Where(p => !p.State.HasFlag(CoinState.Spent)) ?? Enumerable.Empty <Coin>();
                        Fixed8             bonus_available   = Blockchain.CalculateBonus(Program.CurrentWallet.GetUnclaimedCoins().Select(p => p.Reference));
                        Fixed8             bonus_unavailable = Blockchain.CalculateBonus(coins.Where(p => p.State.HasFlag(CoinState.Confirmed) && p.Output.AssetId.Equals(Blockchain.GoverningToken.Hash)).Select(p => p.Reference), Blockchain.Default.Height + 1);
                        Fixed8             bonus             = bonus_available + bonus_unavailable;
                        var assets = coins.GroupBy(p => p.Output.AssetId, (k, g) => new
                        {
                            Asset = Blockchain.Default.GetAssetState(k),
                            Value = g.Sum(p => p.Output.Value),
                            Claim = k.Equals(Blockchain.UtilityToken.Hash) ? bonus : Fixed8.Zero
                        }).ToDictionary(p => p.Asset.AssetId);
                        if (bonus != Fixed8.Zero && !assets.ContainsKey(Blockchain.UtilityToken.Hash))
                        {
                            assets[Blockchain.UtilityToken.Hash] = new
                            {
                                Asset = Blockchain.Default.GetAssetState(Blockchain.UtilityToken.Hash),
                                Value = Fixed8.Zero,
                                Claim = bonus
                            };
                        }
                        var balance_ans = coins.Where(p => p.Output.AssetId.Equals(Blockchain.GoverningToken.Hash)).GroupBy(p => p.Output.ScriptHash).ToDictionary(p => p.Key, p => p.Sum(i => i.Output.Value));
                        var balance_anc = coins.Where(p => p.Output.AssetId.Equals(Blockchain.UtilityToken.Hash)).GroupBy(p => p.Output.ScriptHash).ToDictionary(p => p.Key, p => p.Sum(i => i.Output.Value));
                        foreach (ListViewItem item in listView1.Items)
                        {
                            UInt160 script_hash = Wallet.ToScriptHash(item.Name);
                            Fixed8  ans         = balance_ans.ContainsKey(script_hash) ? balance_ans[script_hash] : Fixed8.Zero;
                            Fixed8  anc         = balance_anc.ContainsKey(script_hash) ? balance_anc[script_hash] : Fixed8.Zero;
                            item.SubItems["ans"].Text = ans.ToString();
                            item.SubItems["anc"].Text = anc.ToString();
                        }
                        foreach (AssetState asset in listView2.Items.OfType <ListViewItem>().Select(p => p.Tag as AssetState).Where(p => p != null).ToArray())
                        {
                            if (!assets.ContainsKey(asset.AssetId))
                            {
                                listView2.Items.RemoveByKey(asset.AssetId.ToString());
                            }
                        }
                        foreach (var asset in assets.Values)
                        {
                            string value_text = asset.Value.ToString() + (asset.Asset.AssetId.Equals(Blockchain.UtilityToken.Hash) ? $"+({asset.Claim})" : "");
                            if (listView2.Items.ContainsKey(asset.Asset.AssetId.ToString()))
                            {
                                listView2.Items[asset.Asset.AssetId.ToString()].SubItems["value"].Text = value_text;
                            }
                            else
                            {
                                string asset_name = asset.Asset.AssetType == AssetType.GoverningToken ? "NEO" :
                                                    asset.Asset.AssetType == AssetType.UtilityToken ? "NeoGas" :
                                                    asset.Asset.GetName();
                                listView2.Items.Add(new ListViewItem(new[]
                                {
                                    new ListViewItem.ListViewSubItem
                                    {
                                        Name = "name",
                                        Text = asset_name
                                    },
                                    new ListViewItem.ListViewSubItem
                                    {
                                        Name = "type",
                                        Text = asset.Asset.AssetType.ToString()
                                    },
                                    new ListViewItem.ListViewSubItem
                                    {
                                        Name = "value",
                                        Text = value_text
                                    },
                                    new ListViewItem.ListViewSubItem
                                    {
                                        ForeColor = Color.Gray,
                                        Name      = "issuer",
                                        Text      = $"{Strings.UnknownIssuer}[{asset.Asset.Owner}]"
                                    }
                                }, -1, listView2.Groups["unchecked"])
                                {
                                    Name = asset.Asset.AssetId.ToString(),
                                    Tag  = asset.Asset,
                                    UseItemStyleForSubItems = false
                                });
                            }
                        }
                        balance_changed = false;
                    }
                    foreach (ListViewItem item in listView2.Groups["unchecked"].Items.OfType <ListViewItem>().ToArray())
                    {
                        ListViewItem.ListViewSubItem subitem = item.SubItems["issuer"];
                        AssetState             asset         = (AssetState)item.Tag;
                        CertificateQueryResult result;
                        if (asset.AssetType == AssetType.GoverningToken || asset.AssetType == AssetType.UtilityToken)
                        {
                            result = new CertificateQueryResult {
                                Type = CertificateQueryResultType.System
                            };
                        }
                        else
                        {
                            result = CertificateQueryService.Query(asset.Owner);
                        }
                        using (result)
                        {
                            subitem.Tag = result.Type;
                            switch (result.Type)
                            {
                            case CertificateQueryResultType.Querying:
                            case CertificateQueryResultType.QueryFailed:
                                break;

                            case CertificateQueryResultType.System:
                                subitem.ForeColor = Color.Green;
                                subitem.Text      = Strings.SystemIssuer;
                                break;

                            case CertificateQueryResultType.Invalid:
                                subitem.ForeColor = Color.Red;
                                subitem.Text      = $"[{Strings.InvalidCertificate}][{asset.Owner}]";
                                break;

                            case CertificateQueryResultType.Expired:
                                subitem.ForeColor = Color.Yellow;
                                subitem.Text      = $"[{Strings.ExpiredCertificate}]{result.Certificate.Subject}[{asset.Owner}]";
                                break;

                            case CertificateQueryResultType.Good:
                                subitem.ForeColor = Color.Black;
                                subitem.Text      = $"{result.Certificate.Subject}[{asset.Owner}]";
                                break;
                            }
                            switch (result.Type)
                            {
                            case CertificateQueryResultType.System:
                            case CertificateQueryResultType.Missing:
                            case CertificateQueryResultType.Invalid:
                            case CertificateQueryResultType.Expired:
                            case CertificateQueryResultType.Good:
                                item.Group = listView2.Groups["checked"];
                                break;
                            }
                        }
                    }
                }
                if (check_nep5_balance && persistence_span > TimeSpan.FromSeconds(2))
                {
                    UInt160[] addresses = Program.CurrentWallet.GetAddresses().ToArray();
                    foreach (string s in Settings.Default.NEP5Watched)
                    {
                        UInt160 script_hash = UInt160.Parse(s);
                        byte[]  script;
                        using (ScriptBuilder sb = new ScriptBuilder())
                        {
                            foreach (UInt160 address in addresses)
                            {
                                sb.EmitAppCall(script_hash, "balanceOf", address);
                            }
                            sb.Emit(OpCode.DEPTH, OpCode.PACK);
                            sb.EmitAppCall(script_hash, "decimals");
                            sb.EmitAppCall(script_hash, "name");
                            script = sb.ToArray();
                        }
                        ApplicationEngine engine = TestEngine.Run(script);
                        if (engine == null)
                        {
                            continue;
                        }
                        string     name     = engine.EvaluationStack.Pop().GetString();
                        byte       decimals = (byte)engine.EvaluationStack.Pop().GetBigInteger();
                        BigInteger amount   = engine.EvaluationStack.Pop().GetArray().Aggregate(BigInteger.Zero, (x, y) => x + y.GetBigInteger());
                        if (amount == 0)
                        {
                            continue;
                        }
                        BigDecimal balance    = new BigDecimal(amount, decimals);
                        string     value_text = balance.ToString();
                        if (listView2.Items.ContainsKey(script_hash.ToString()))
                        {
                            listView2.Items[script_hash.ToString()].SubItems["value"].Text = value_text;
                        }
                        else
                        {
                            listView2.Items.Add(new ListViewItem(new[]
                            {
                                new ListViewItem.ListViewSubItem
                                {
                                    Name = "name",
                                    Text = name
                                },
                                new ListViewItem.ListViewSubItem
                                {
                                    Name = "type",
                                    Text = "NEP-5"
                                },
                                new ListViewItem.ListViewSubItem
                                {
                                    Name = "value",
                                    Text = value_text
                                },
                                new ListViewItem.ListViewSubItem
                                {
                                    ForeColor = Color.Gray,
                                    Name      = "issuer",
                                    Text      = $"ScriptHash:{script_hash}"
                                }
                            }, -1, listView2.Groups["checked"])
                            {
                                Name = script_hash.ToString(),
                                UseItemStyleForSubItems = false
                            });
                        }
                    }
                    check_nep5_balance = false;
                }
            }
        }
Example #28
0
 public void CreateRunner(TestPackage testPackage)
 {
     package = testPackage;
     Runner  = TestEngine.GetRunner(package);
 }
Example #29
0
        public static int Main(string[] args)
        {
            AgentId   = new Guid(args[0]);
            AgencyUrl = args[1];

            bool pause = false, verbose = false;

            for (int i = 2; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "--pause":
                    pause = true;
                    break;

                case "--verbose":
                    verbose = true;
                    break;
                }
            }
#if DEBUG
            if (pause)
            {
                System.Windows.Forms.MessageBox.Show("Attach debugger if desired, then press OK", "NUnit-Agent");
            }
#endif

            // Create SettingsService early so we know the trace level right at the start
            SettingsService settingsService = new SettingsService("NUnit30Settings.xml", false);
            //InternalTrace.Initialize("nunit-agent_%p.log", (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default));

            //log.Info("Agent process {0} starting", Process.GetCurrentProcess().Id);
            //log.Info("Running under version {0}, {1}",
            //    Environment.Version,
            //    RuntimeFramework.CurrentFramework.DisplayName);

            if (verbose)
            {
                Console.WriteLine("Agent process {0} starting", Process.GetCurrentProcess().Id);
                Console.WriteLine("Running under version {0}, {1}",
                                  Environment.Version,
                                  RuntimeFramework.CurrentFramework.DisplayName);
            }

            // Create TestEngine - this program is
            // conceptually part of  the engine and
            // can access it's internals as needed.
            TestEngine engine = new TestEngine();

            // Custom Service Initialization
            //log.Info("Adding Services");
            engine.Services.Add(settingsService);
            engine.Services.Add(new ProjectService());
            engine.Services.Add(new DomainManager());
            engine.Services.Add(new InProcessTestRunnerFactory());
            engine.Services.Add(new DriverFactory());
            //engine.Services.Add( new TestLoader() );

            // Initialize Services
            //log.Info("Initializing Services");
            engine.Services.ServiceManager.InitializeServices();

            Channel = ServerUtilities.GetTcpChannel();

            //log.Info("Connecting to TestAgency at {0}", AgencyUrl);
            try
            {
                Agency = Activator.GetObject(typeof(ITestAgency), AgencyUrl) as ITestAgency;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to connect\r\n{0}", ex);
                //log.Error("Unable to connect", ex);
            }

            if (Channel != null)
            {
                //log.Info("Starting RemoteTestAgent");
                RemoteTestAgent agent = new RemoteTestAgent(AgentId, Agency, engine.Services);

                try
                {
                    if (agent.Start())
                    {
                        //log.Debug("Waiting for stopSignal");
                        agent.WaitForStop();
                        //log.Debug("Stop signal received");
                    }
                    else
                    {
                        Console.WriteLine("Failed to start RemoteTestAgent");
                    }
                    //log.Error("Failed to start RemoteTestAgent");
                }
                catch (Exception ex)
                {
                    //log.Error("Exception in RemoteTestAgent", ex);
                    Console.WriteLine("Exception in RemoteTestAgent", ex);
                }

                //log.Info("Unregistering Channel");
                try
                {
                    ChannelServices.UnregisterChannel(Channel);
                }
                catch (Exception ex)
                {
                    //log.Error("ChannelServices.UnregisterChannel threw an exception", ex);
                    Console.WriteLine("ChannelServices.UnregisterChannel threw an exception\r\n{0}", ex);
                }
            }

            if (verbose)
            {
                Console.WriteLine("Agent process {0} exiting", Process.GetCurrentProcess().Id);
            }
            //log.Info("Agent process {0} exiting", Process.GetCurrentProcess().Id);
            //InternalTrace.Close();

            return(0);
        }
Example #30
0
 private ITestResultParser GetTestResultParser(TestEngine testEngine)
 {
     switch (testEngine)
     {
         case TestEngine.MsTest:
             return new MsTestResultParser();
         default:
             throw new NotSupportedException();
     }
 }
 public void Init()
 {
     testengine = new TestEngine();
     testengine.AddEntryScript("./TestClasses/Contract_NULL.cs");
 }
 public void Init()
 {
     _engine = new TestEngine();
     Assert.IsTrue(_engine.AddEntryScript("./TestClasses/Contract_Attribute.cs").Success);
 }
        private void initialize(Func<IProject> getProject)
        {
            if (_project != null)
            {
                Dispose();
            }

            _project = getProject();
            _engine = new TestEngine();
            _engine.StopConditions.TimeoutInSeconds = _project.TimeoutInSeconds;
            _engine.Handle(new ProjectLoaded(_project));

            // TODO -- Bring this back when it gets smarter: https://github.com/DarthFubuMVC/StoryTeller2/issues/2
            //_engine.UseTeamCityListener();

            _hierarchy = _project.LoadTests();
        }
Example #34
0
 public void Init()
 {
     _engine = new TestEngine(snapshot: new TestDataCache());
     _engine.AddEntryScript("./TestClasses/Contract_Json.cs");
 }
Example #35
0
 public void Init()
 {
     _engine = new TestEngine(TriggerType.Application, new DummyVerificable());
     _engine.AddEntryScript("./TestClasses/Contract_Runtime.cs");
 }
        public void LongParse_Test()
        {
            using var testengine = new TestEngine(snapshot: new TestDataCache());
            testengine.AddEntryScript("./TestClasses/Contract_IntegerParse.cs");
            string methodname = "testLongparse";

            var result = testengine.ExecuteTestCaseStandard(methodname, " -9223372036854775808");
            var value  = result.Pop().GetInteger();

            Assert.AreEqual(-9223372036854775808, value);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "9223372036854775807");

            value = result.Pop().GetInteger();
            Assert.AreEqual(9223372036854775807, value);

            //test backspace trip
            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "20 ");

            value = result.Pop().GetInteger();
            Assert.AreEqual(20, value);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, " 20 ");

            value = result.Pop().GetInteger();
            Assert.AreEqual(20, value);


            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "-9223372036854775809");

            Assert.AreEqual(VMState.FAULT, testengine.State);
            Assert.IsNotNull(testengine.FaultException);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "9223372036854775808");

            Assert.AreEqual(VMState.FAULT, testengine.State);
            Assert.IsNotNull(testengine.FaultException);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "");

            Assert.AreEqual(VMState.FAULT, testengine.State);
            Assert.IsNotNull(testengine.FaultException);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "abc");

            Assert.AreEqual(VMState.FAULT, testengine.State);
            Assert.IsNotNull(testengine.FaultException);

            testengine.Reset();
            result = testengine.ExecuteTestCaseStandard(methodname, "@");

            Assert.AreEqual(VMState.FAULT, testengine.State);
            Assert.IsNotNull(testengine.FaultException);
        }
Example #37
0
 public void Init()
 {
     _engine = CreateEngine();
 }
Example #38
0
 public void setup()
 {
     errorList = new List<IErrorDescriptor>();
     tests.Clear();
     e = new TestEngine();
     e.OnInvalidBinding += new TestEngine.ControllerEvent(e_OnInvalidBinding);
     e.OnResourceLoop += new TestEngine.MethodEvent(e_OnResourceLoop);
     e.OnMissingProvider += new TestEngine.MethodEvent(e_OnMissingProvider);
     e.OnInconsistentResourceType += new TestEngine.MethodResourceEvent(e_OnInconsistentResourceType);
 }
Example #39
0
 public void Init()
 {
     _engine = new TestEngine();
     _engine.AddEntryScript("./TestClasses/Contract_Foreach.cs");
 }
Example #40
0
        public static void Main(string[] args)
        {
            AgentId   = new Guid(args[0]);
            AgencyUrl = args[1];

            var traceLevel     = InternalTraceLevel.Off;
            var pid            = Process.GetCurrentProcess().Id;
            var debugArgPassed = false;
            var workDirectory  = string.Empty;
            var agencyPid      = string.Empty;

            for (int i = 2; i < args.Length; i++)
            {
                string arg = args[i];

                // NOTE: we can test these strings exactly since
                // they originate from the engine itself.
                if (arg == "--debug-agent")
                {
                    debugArgPassed = true;
                }
                else if (arg.StartsWith("--trace:"))
                {
                    traceLevel = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), arg.Substring(8));
                }
                else if (arg.StartsWith("--pid="))
                {
                    agencyPid = arg.Substring(6);
                }
                else if (arg.StartsWith("--work="))
                {
                    workDirectory = arg.Substring(7);
                }
            }

            var logName = $"nunit-agent_{pid}.log";

            InternalTrace.Initialize(Path.Combine(workDirectory, logName), traceLevel);
            log = InternalTrace.GetLogger(typeof(NUnitTestAgent));

            if (debugArgPassed)
            {
                TryLaunchDebugger();
            }

            LocateAgencyProcess(agencyPid);

            log.Info("Agent process {0} starting", pid);
            log.Info("Running under version {0}, {1}",
                     Environment.Version,
                     RuntimeFramework.CurrentFramework.DisplayName);

            // Restore the COMPLUS_Version env variable if it's been overridden by TestAgency::LaunchAgentProcess
            try
            {
                string cpvOriginal = Environment.GetEnvironmentVariable("TestAgency_COMPLUS_Version_Original");
                if (!string.IsNullOrEmpty(cpvOriginal))
                {
                    log.Debug("Agent process has the COMPLUS_Version environment variable value \"{0}\" overridden with \"{1}\", restoring the original value.", cpvOriginal, Environment.GetEnvironmentVariable("COMPLUS_Version"));
                    Environment.SetEnvironmentVariable("TestAgency_COMPLUS_Version_Original", null, EnvironmentVariableTarget.Process);                     // Erase marker
                    Environment.SetEnvironmentVariable("COMPLUS_Version", (cpvOriginal == "NULL" ? null : cpvOriginal), EnvironmentVariableTarget.Process); // Restore original (which might be n/a)
                }
            }
            catch (Exception ex)
            {
                log.Warning("Failed to restore the COMPLUS_Version variable. " + ex.Message); // Proceed with running tests anyway
            }

            // Create TestEngine - this program is
            // conceptually part of  the engine and
            // can access its internals as needed.
            var engine = new TestEngine
            {
                InternalTraceLevel = traceLevel
            };

            // Custom Service Initialization
            engine.Services.Add(new ExtensionService());
            engine.Services.Add(new DomainManager());
            engine.Services.Add(new InProcessTestRunnerFactory());
            engine.Services.Add(new DriverService());

            // Initialize Services
            log.Info("Initializing Services");
            engine.Initialize();

            log.Info("Starting RemoteTestAgent");
            Agent = new RemoteTestAgent(AgentId, AgencyUrl, engine.Services);

            try
            {
                if (Agent.Start())
                {
                    WaitForStop();
                }
                else
                {
                    log.Error("Failed to start RemoteTestAgent");
                    Environment.Exit(AgentExitCodes.FAILED_TO_START_REMOTE_AGENT);
                }
            }
            catch (Exception ex)
            {
                log.Error("Exception in RemoteTestAgent. {0}", ExceptionHelper.BuildMessageAndStackTrace(ex));
                Environment.Exit(AgentExitCodes.UNEXPECTED_EXCEPTION);
            }
            log.Info("Agent process {0} exiting cleanly", pid);

            Environment.Exit(AgentExitCodes.OK);
        }
Example #41
0
 public void Init()
 {
     _engine = new TestEngine(TriggerType.Application, new DummyVerificable());
     _engine.AddEntryScript("./TestClasses/Contract_ExecutionEngine.cs");
     scriptHash = _engine.Nef.Script.Span.ToScriptHash().ToArray().ToHexString();
 }
 public void Init()
 {
     _engine = new TestEngine();
     _engine.AddEntryScript("./TestClasses/Contract_Extensions.cs");
 }
Example #43
0
 public void Init()
 {
     _engine = new TestEngine();
     _engine.AddEntryScript("./TestClasses/Contract_Concat.cs", false, false);
 }
 public void double_Test()
 {
     using var testengine = new TestEngine();
     Assert.IsFalse(testengine.AddEntryScript("./TestClasses/Contract_Types_Double.cs").Success);
 }
 public void Dispose()
 {
     _engine.Dispose();
     _engine = null;
 }
Example #46
0
        void e_OnMissingProvider(object sender, TestEngine.MethodEventArgs e)
        {
            List<string> loopControllers = new List<string>();
            foreach (ITypeInfo ctrType in e.Controllers)
            {
                loopControllers.Add(ctrType.FullName);
            }

            ErrorMissingProvider errMissProv = new ErrorMissingProvider(e.MethodUrl, e.ResourceName, loopControllers.ToArray());
            errorList.Add(errMissProv);

        }