public void ValueSelfDescribingTest() { var actual = new Description() .Text("Line 1") .Value(new MySelfDescriber((IDescription desc) => { desc.Text("Self1.A"); desc.Text("Self1.B"); desc.Text("Self1.C"); })) .Value("label", "value") .Value("Self2", new MySelfDescriber((IDescription desc) => { desc.Text("Self2.A"); desc.Text("Self2.B"); desc.Text("Self2.C"); })) .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("Self1.A"); expect.AppendLine("Self1.B"); expect.AppendLine("Self1.C"); expect.AppendLine("label:value"); expect.AppendLine("Self2:"); expect.AppendLine("Self2.A"); expect.AppendLine("Self2.B"); expect.AppendLine("Self2.C"); AssertEqual(expect.ToString(), actual); }
static void Main(string[] args) { Description desc = new Description("C# Dummy", "dummy"); desc.addDataSeries("val1", new DataSeriesInfo(Value.Type.STRING, 0, "")); desc.addDataSeries("val2", new DataSeriesInfo(Value.Type.DOUBLE, (int)DataSeriesInfo.Property.INTERPOLATABLE, "")); desc.addDataSeries("val3", new DataSeriesInfo(Value.Type.DOUBLE, (int)(DataSeriesInfo.Property.INTERPOLATABLE | DataSeriesInfo.Property.HAS_MINMAX), "", 0.0, 1.0)); int cnt = 0; using (Sender sender = new Sender(desc, new StringMap())) { DataMessage msg = sender.createDataMessage(); long start = DateTime.Now.Ticks; while (DateTime.Now.Ticks < start + 5 * TimeSpan.TicksPerSecond) { msg.setString("val1", "hello"); msg.setDouble("val2", 42.0); msg.setDouble("val3", 0.5); sender.sendMessage(msg); cnt++; } } System.Console.Out.WriteLine(cnt); System.Console.ReadLine(); }
static GumpExtUtility() { _PositionProps = new Dictionary<Type, Description>(); PropertyInfo x, y, w, h; foreach (var t in typeof(GumpEntry).FindChildren(t => !t.IsAbstract)) { if (!t.HasInterface<IGumpEntryPoint>()) { x = t.GetProperty("X", typeof(int)); y = t.GetProperty("Y", typeof(int)); } else { x = y = null; } if (!t.HasInterface<IGumpEntrySize>()) { w = t.GetProperty("Width", typeof(int)); h = t.GetProperty("Height", typeof(int)); } else { w = h = null; } if (x != null || y != null || w != null || h != null) { _PositionProps[t] = new Description(x, y, w, h); } } }
public Classe(Description.Classe classe) { _classe = classe; _reflexe = Computed.From(() => _classe.Sauvegardes.Reflexe(Niveau)); _vigueur = Computed.From(() => _classe.Sauvegardes.Vigueur(Niveau)); _volonte = Computed.From(() => _classe.Sauvegardes.Volonte(Niveau)); _bonusDeBaseAttaque = Computed.From(() => _classe.BonusDeBaseAttaque(Niveau)); }
public override Statement Apply(Statement s, Description d) { if (!d.Suite) { throw new System.ArgumentException("this is a @ClassRule (applies to suites only)."); } return new StatementAnonymousInnerClassHelper(this, s, d); }
public override void TestFinished(Description description) { if (TestFailed) { ReportAdditionalFailureInfo(StripTestNameAugmentations(description.MethodName)); } Scope = LifecycleScope.SUITE; TestFailed = false; }
public void Add(string resource, string propertyName, string propertyValue) { Description description; if (!_resources.TryGetValue(resource, out description)) { description = new Description(); _resources.Add(resource, description); } description.Add(propertyName, propertyValue); }
public ResourceMetaDataType(MBeanInfo beanInfo) : base(beanInfo.Descriptor) { Description = new Description { Value = beanInfo.Description }; DynamicMBeanResourceClass = beanInfo.ClassName; FactoryType = beanInfo.Constructors.Select(x => new FactoryModelInfoType(x)).ToArray(); NotificationType = beanInfo.Notifications.Select(x => new NotificationModelInfoType(x)).ToArray(); OperationType = beanInfo.Operations.Select(x => new OperationModelInfoType(x)).ToArray(); PropertyType = beanInfo.Attributes.Select(x => new PropertyModelInfoType(x)).ToArray(); }
public PrivateSurface(ref Description surfaceDescription) : base(ref surfaceDescription) { _CanvasContext = new WeakReference(null); Canvas canvas = new Canvas(Region.Size, SurfaceUsage.Private); _SurfaceCanvas = new TargetContext(canvas, Region, this); _SurfaceCanvas.BackingContext = _SurfaceCanvas; }
public virtual void describeTo(Description description) { if (this.fMatcher != null) { description.appendText("got: "); description.appendValue(this.fValue); description.appendText(", expected: "); description.appendDescriptionOf((SelfDescribing) this.fMatcher); } else description.appendText(new StringBuilder().append("failed assumption: ").append(this.fValue).toString()); }
public SharedSurface(ref Description surfaceDescription) : base(ref surfaceDescription) { _UsedRegions = new LinkedList<CanvasData>(); _FreeRegions = new LinkedList<Rectangle>(); _FreeRegions.AddLast(new Rectangle(Point.Empty, Region.Size)); Canvas canvas = new Canvas(Region.Size, SurfaceUsage.Private); _SurfaceCanvas = new TargetContext(canvas, Region, this, new LinkedListNode<CanvasData>(new CanvasData())); _SurfaceCanvas.BackingContext = _SurfaceCanvas; }
public void TextTest() { var actual = new Description() .Text("Line 1") .Text("Line 2") .Value("Val") .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("Line 2"); expect.AppendLine("Val"); AssertEqual(expect.ToString(), actual); }
public SearchFilter GetSearchFilterForNode(NodeContent nodeContent) { var configFilter = new SearchFilter { field = BaseCatalogIndexBuilder.FieldConstants.Node, Descriptions = new Descriptions { defaultLocale = _preferredCulture.Name }, Values = new SearchFilterValues() }; var desc = new Description { locale = "en", Value = _localizationService.GetString("/Facet/Category") }; configFilter.Descriptions.Description = new[] { desc }; var nodes = _contentLoader.GetChildren<NodeContent>(nodeContent.ContentLink).ToList(); var nodeValues = new SimpleValue[nodes.Count]; var index = 0; foreach (var node in nodes) { var val = new SimpleValue { key = node.Code, value = node.Code, Descriptions = new Descriptions { defaultLocale = _preferredCulture.Name } }; var desc2 = new Description { locale = _preferredCulture.Name, Value = node.DisplayName }; val.Descriptions.Description = new[] { desc2 }; nodeValues[index] = val; index++; } configFilter.Values.SimpleValue = nodeValues; return configFilter; }
public DynamicSurface(ref Description surfaceDescription) : base(ref surfaceDescription) { _FreeRegions = new LinkedList<Rectangle>(); _FreeArea = Region.Area; _UsedRegions = new List<Canvas.ResolvedContext>(); _FreeRegions.AddLast(new Rectangle(Point.Empty, Region.Size)); Canvas canvas = new Canvas(Region.Size, SurfaceUsage.Private); _SurfaceCanvas = new TargetContext(canvas, Region, this); _SurfaceCanvas.BackingContext = _SurfaceCanvas; }
public override void describeTo(Description description) { Pattern pattern = DescribedAs.ARG_PATTERN; object obj = (object) this.descriptionTemplate; CharSequence charSequence1; charSequence1.__\u003Cref\u003E = (__Null) obj; CharSequence charSequence2 = charSequence1; Matcher matcher = pattern.matcher(charSequence2); int num = 0; while (matcher.find()) { description.appendText(String.instancehelper_substring(this.descriptionTemplate, num, matcher.start())); int index = Integer.parseInt(matcher.group(1)); description.appendValue(this.values[index]); num = matcher.end(); } if (num >= String.instancehelper_length(this.descriptionTemplate)) return; description.appendText(String.instancehelper_substring(this.descriptionTemplate, num)); }
public void ValueTest() { var actual = new Description() .Text("Line 1") .Text("Line 2") .Value("value1") .Value("value2") .Value("labelA", "valueA") .Value("labelB", "valueB") .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("Line 2"); expect.AppendLine("value1"); expect.AppendLine("value2"); expect.AppendLine("labelA:valueA"); expect.AppendLine("labelB:valueB"); AssertEqual(expect.ToString(), actual); }
public override void VisitDescription(Description description) { base.VisitDescription(description); }
public void ChildTest() { var actual = new Description() .Text("Line 1") .Child("Child1", new MySelfDescriber((IDescription desc) => { desc.Text("Child1.A"); desc.Text("Child1.B"); })) .Child("Child2",new MySelfDescriber((IDescription desc) => { desc.Text("Child2.A"); desc.Text("Child2.B"); })) .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("Child1:"); expect.AppendLine(Indent + "Child1.A"); expect.AppendLine(Indent + "Child1.B"); expect.AppendLine("Child2:"); expect.AppendLine(Indent + "Child2.A"); expect.AppendLine(Indent + "Child2.B"); AssertEqual(expect.ToString(), actual); }
public override int GetHashCode() { return(Item.GetHashCode() ^ Start.GetHashCode() ^ End.GetHashCode() ^ Description.GetHashCode()); }
public void ChildChildTest() { var child = new MySelfDescriber((IDescription desc1) => { desc1.Text("Child1.A"); desc1.Text("Child1.B"); var child2 = new MySelfDescriber((IDescription desc2) => { desc2.Text("Child2.A"); desc2.Text("Child2.B"); desc2.Text("Child2.C"); var child3 = new MySelfDescriber((IDescription desc3) => { desc3.Text("Child3.A"); desc3.Text("Child3.B"); desc3.Text("Child3.C"); }); desc2.Child("Child3", child3); }); desc1.Child("Child2", child2); }); var actual = new Description() .Text("My Line 1") .Child("Child1", child) .ToString(); var expect = new StringBuilder(); expect.AppendLine("My Line 1"); expect.AppendLine("Child1:"); expect.AppendLine(Indent + "Child1.A"); expect.AppendLine(Indent + "Child1.B"); expect.AppendLine(Indent + "Child2:"); expect.AppendLine(Indent + Indent + "Child2.A"); expect.AppendLine(Indent + Indent + "Child2.B"); expect.AppendLine(Indent + Indent + "Child2.C"); expect.AppendLine(Indent + Indent + "Child3:"); expect.AppendLine(Indent + Indent + Indent + "Child3.A"); expect.AppendLine(Indent + Indent + Indent + "Child3.B"); expect.AppendLine(Indent + Indent + Indent + "Child3.C"); AssertEqual(expect.ToString(), actual); }
public void ChildrenChildTest() { var children = new List<ISelfDescribing>() { new MySelfDescriber((IDescription desc) => { desc.Text("Child1.A"); desc.Text("Child1.B"); }), new MySelfDescriber((IDescription desc) => { desc.Text("Child2.A"); desc.Text("Child2.B"); desc.Child("Child3",new MySelfDescriber((IDescription desc2) => { desc2.Text("Child3.A"); desc2.Text("Child3.B"); })); desc.Child("Child4",new MySelfDescriber((IDescription desc2) => { desc2.Text("Child4.A"); desc2.Text("Child4.B"); })); desc.Child(new MySelfDescriber((IDescription desc2) => { desc2.Text("Child5.A"); desc2.Text("Child5.B"); })); }), }; var actual = new Description() .Text("Line 1") //label .Children("MyChildren", children) .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("MyChildren:"); expect.AppendLine(Indent + "Child1.A"); expect.AppendLine(Indent + "Child1.B"); expect.AppendLine(Indent + "Child2.A"); expect.AppendLine(Indent + "Child2.B"); expect.AppendLine(Indent + "Child3:"); expect.AppendLine(Indent + Indent + "Child3.A"); expect.AppendLine(Indent + Indent + "Child3.B"); expect.AppendLine(Indent + "Child4:"); expect.AppendLine(Indent + Indent + "Child4.A"); expect.AppendLine(Indent + Indent + "Child4.B"); expect.AppendLine(Indent + Indent + "Child5.A"); expect.AppendLine(Indent + Indent + "Child5.B"); AssertEqual(expect.ToString(), actual); }
public override void SetDefaults() { DisplayName.SetDefault("Laser Javelin"); Description.SetDefault("Losing life"); }
public void NullChildTest() { var actual = new Description() .Text("Line 1") .Child(null) .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine(Indent + "null"); AssertEqual(expect.ToString(), actual); }
public override void SetStaticDefaults() { base.SetStaticDefaults(); DisplayName.SetDefault("Lil' Gator"); Description.SetDefault("A surfing gator has joined your adventure!"); }
/// <summary> /// Saves the description. /// </summary> /// <param name="document">The document.</param> /// <returns>Description.</returns> /// <exception cref="NotImplementedException"></exception> public Description SaveDescription(Description document) { return ManageTaxoPortal .Agent .SaveDescription(document); }
/// <summary> /// Deletes the description. /// </summary> /// <param name="document">The document.</param> /// <returns>Description.</returns> /// <exception cref="NotImplementedException"></exception> public Description DeleteDescription(Description document) { return ManageTaxoPortal .Agent .DeleteDescription(document); }
public LineLegendItem(Description description) : base(description) { InitializeComponent(); }
public override void ParseElement(XmlElement element) { XmlNodeList resourcess = element.SelectNodes("resources"), descriptionss = element.SelectNodes("description"), assets, conditions, frontcolors, bordercolors, textcolors = element.SelectNodes("textcolor"), conversationsref = element.SelectNodes("conversation-ref"), voices = element.SelectNodes("voice"), actionss = element.SelectNodes("actions"); string tmpArgVal; string characterId = element.GetAttribute("id"); npc = new NPC(characterId); descriptions = new List<Description>(); npc.setDescriptions(descriptions); if (element.SelectSingleNode("documentation") != null) npc.setDocumentation(element.SelectSingleNode("documentation").InnerText); foreach (XmlElement el in resourcess) { currentResources = new ResourcesUni(); tmpArgVal = el.GetAttribute("name"); if (!string.IsNullOrEmpty(tmpArgVal)) { currentResources.setName(el.GetAttribute(tmpArgVal)); } assets = el.SelectNodes("asset"); foreach (XmlElement ell in assets) { string type = ""; string path = ""; tmpArgVal = ell.GetAttribute("type"); if (!string.IsNullOrEmpty(tmpArgVal)) { type = tmpArgVal; } tmpArgVal = ell.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } currentResources.addAsset(type, path); } conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); currentResources.setConditions(currentConditions); } npc.addResources(currentResources); } foreach (XmlElement el in textcolors) { tmpArgVal = el.GetAttribute("showsSpeechBubble"); if (!string.IsNullOrEmpty(tmpArgVal)) { npc.setShowsSpeechBubbles(tmpArgVal.Equals("yes")); } tmpArgVal = el.GetAttribute("bubbleBkgColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { npc.setBubbleBkgColor(tmpArgVal); } tmpArgVal = el.GetAttribute("bubbleBorderColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { npc.setBubbleBorderColor(tmpArgVal); } frontcolors = el.SelectNodes("frontcolor"); foreach (XmlElement ell in frontcolors) { string color = ""; tmpArgVal = ell.GetAttribute("color"); if (!string.IsNullOrEmpty(tmpArgVal)) { color = tmpArgVal; } npc.setTextFrontColor(color); } bordercolors = el.SelectNodes("bordercolor"); foreach (XmlElement ell in bordercolors) { string color = ""; tmpArgVal = ell.GetAttribute("color"); if (!string.IsNullOrEmpty(tmpArgVal)) { color = tmpArgVal; } npc.setTextBorderColor(color); } } foreach (XmlElement el in conversationsref) { string idTarget = ""; tmpArgVal = el.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { idTarget = tmpArgVal; } conversationReference = new ConversationReference(idTarget); conditions = el.SelectNodes("condition"); foreach (XmlElement ell in conditions) { currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(ell); conversationReference.setConditions(currentConditions); } conversationReference.setDocumentation(el.SelectSingleNode("documentation").InnerText); Action action = new Action(Action.TALK_TO); action.setConditions(conversationReference.getConditions()); action.setDocumentation(conversationReference.getDocumentation()); TriggerConversationEffect effect = new TriggerConversationEffect(conversationReference.getTargetId()); action.getEffects().add(effect); npc.addAction(action); } foreach (XmlElement el in voices) { string voice = ""; string response; bool alwaysSynthesizer = false; tmpArgVal = el.GetAttribute("name"); if (!string.IsNullOrEmpty(tmpArgVal)) { voice = tmpArgVal; } tmpArgVal = el.GetAttribute("synthesizeAlways"); if (!string.IsNullOrEmpty(tmpArgVal)) { response = tmpArgVal; if (response.Equals("yes")) alwaysSynthesizer = true; } npc.setAlwaysSynthesizer(alwaysSynthesizer); npc.setVoice(voice); } foreach (XmlElement el in actionss) { new ActionsSubParser_(chapter, npc).ParseElement(el); } foreach (XmlElement el in descriptionss) { description = new Description(); new DescriptionsSubParser_(description, chapter).ParseElement(el); this.descriptions.Add(description); } chapter.addCharacter(npc); }
public override void describeTo(Description description) { description.appendText("not ").appendDescriptionOf((SelfDescribing) this.matcher); }
public override void SetDefaults() { DisplayName.SetDefault("Ultra Slash - Break"); Description.SetDefault("13% More damage and enchance slash"); Main.buffNoSave[Type] = true; }
public override void describeTo(Description description) { description.appendText("null"); }
public void ChildrenTest() { var children = new List<ISelfDescribing>() { new MySelfDescriber((IDescription desc) => { desc.Text("ChildValueA.1"); desc.Text("ChildValueA.2"); }), new MySelfDescriber((IDescription desc) => { desc.Text("ChildValueB.1"); desc.Text("ChildValueB.2"); }), new MySelfDescriber((IDescription desc) => { desc.Text("ChildValueC.1"); desc.Text("ChildValueC.2"); }), }; var actual = new Description() .Text("Line 1") .Children("MyChildren", children) .ToString(); var expect = new StringBuilder(); expect.AppendLine("Line 1"); expect.AppendLine("MyChildren:"); expect.AppendLine(Indent + "ChildValueA.1"); expect.AppendLine(Indent + "ChildValueA.2"); expect.AppendLine(Indent + "ChildValueB.1"); expect.AppendLine(Indent + "ChildValueB.2"); expect.AppendLine(Indent + "ChildValueC.1"); expect.AppendLine(Indent + "ChildValueC.2"); AssertEqual(expect.ToString(), actual); }
public StatementAnonymousInnerClassHelper(TestRuleIgnoreTestSuites outerInstance, Statement s, Description d) { this.OuterInstance = outerInstance; this.s = s; this.d = d; }
public override void describeTo(Description description) { description.appendText("a string ").appendText(this.relationship()).appendText(" ").appendValue((object) this.__\u003C\u003Esubstring); }
public override Statement Apply(Statement s, Description d) { return new StatementAnonymousInnerClassHelper(this, s); }
public void Describe(Description description) { description.ShortDescription = "Download from " + _url; }