public void IndexOfTest() { { var sut = new IndexOfString( new StringConstant("This is a test"), new StringConstant("is") ); Assert.AreEqual(2, sut.Value); } { var sut = new IndexOfString( new StringConstant("This is a test"), new StringConstant("is"), new NumericConstant(3) ); Assert.AreEqual(5, sut.Value); } }
public void MakeUpdateResultsLogix() { Slot nodesContainer = nodesContainerSlot[0][0][0]; Slot nodeTemplate = mainSlot.AddSlot("NodeTemplate"); Slot template = nodesContainer[nodesContainer.ChildrenCount - 1].Duplicate(); template.SetParent(nodeTemplate); ButtonRelay <string> buttonRelay = template.GetComponent <ButtonRelay <string> >(); Slot templateLogix = template.AddSlot("logix"); Actions.WriteValueNode <string> writeThing = templateLogix.AttachComponent <Actions.WriteValueNode <string> >(); DynamicImpulseReceiverWithValue <string> receiver = templateLogix.AttachComponent <DynamicImpulseReceiverWithValue <string> >(); ValueField <string> tag = templateLogix.AttachComponent <ValueField <string> >(); tag.Value.Value = "setUpNode"; receiver.Tag.Value = tag.Value.ReferenceID; writeThing.Value.Value = receiver.Value.ReferenceID; ValueField <string> response = templateLogix.AttachComponent <ValueField <string> >(); writeThing.Target.Value = response.Value.ReferenceID; receiver.Impulse.Target = writeThing.Write; ForNode iterator = templateLogix.AttachComponent <ForNode>(); Slot logix = templateLogix; Substring getResultSubstring = logix.AttachComponent <Substring>(); IndexOfString findSeparator = logix.AttachComponent <IndexOfString>(); getResultSubstring.Str.Value = searchResponse.Value.ReferenceID; findSeparator.Str.Value = searchResponse.Value.ReferenceID; ValueField <int> currentIndex = logix.AttachComponent <ValueField <int> >(); getResultSubstring.StartIndex.Value = currentIndex.Value.ReferenceID; findSeparator.StartIndex.Value = currentIndex.Value.ReferenceID; ValueField <string> separator = logix.AttachComponent <ValueField <string> >(); separator.Value.Value = ","; findSeparator.Part.Value = separator.Value.ReferenceID; Sub_Int lengthOfPart = logix.AttachComponent <Sub_Int>(); lengthOfPart.A.Value = findSeparator.ReferenceID; lengthOfPart.B.Value = currentIndex.Value.ReferenceID; getResultSubstring.Length.Value = lengthOfPart.ReferenceID; //Slot logix = mainSlot.AddSlot("Update search results logix"); //ReferenceField<Slot> containerSlotStore = logix.AttachComponent<ReferenceField<Slot>>(); //containerSlotStore.Reference.Value = nodesContainer.ReferenceID; //DestroySlotChildren destroyContainerContents = logix.AttachComponent<DestroySlotChildren>(); //destroyContainerContents.Instance.Value = nodesContainer.ReferenceID; //WhileNode whileNode = logix.AttachComponent<WhileNode>(); //Substring getResultSubstring = logix.AttachComponent<Substring>(); //IndexOfString findSeparator = logix.AttachComponent<IndexOfString>(); //getResultSubstring.Str.Value = searchResponse.Value.ReferenceID; //findSeparator.Str.Value = searchResponse.Value.ReferenceID; //ValueField<int> currentIndex = logix.AttachComponent<ValueField<int>>(); //getResultSubstring.StartIndex.Value = currentIndex.Value.ReferenceID; //findSeparator.StartIndex.Value = currentIndex.Value.ReferenceID; //ValueField<string> separator = logix.AttachComponent<ValueField<string>>(); //separator.Value.Value = "|"; //findSeparator.Part.Value = separator.Value.ReferenceID; //Sub_Int lengthOfPart = logix.AttachComponent<Sub_Int>(); //lengthOfPart.A.Value = findSeparator.ReferenceID; //lengthOfPart.B.Value = currentIndex.Value.ReferenceID; //getResultSubstring.Length.Value = lengthOfPart.ReferenceID; //DynamicImpulseTriggerWithValue<string> receive_part = logix.AttachComponent<DynamicImpulseTriggerWithValue<string>>(); }