public void GenerateDocumentation(IDocumentationGenerator generator) { if (GoldCost != 0) { generator.PropertyValuePair("Cost", $"{GoldCost}{Naming.Gold}"); } }
public void create_stubs() { StubWriter = MockRepository.GenerateStub <IScreenWriter>(); StubDocGen = MockRepository.GenerateStub <IDocumentationGenerator>(); StubEventAggregator = MockRepository.GenerateStub <IEventAggregator>(); StubEventAggregator.Stub(x => x.GetEvent <WarningEvent>()).Return(new WarningEvent()); StubEventAggregator.Stub(x => x.GetEvent <BadFileEvent>()).Return(new BadFileEvent()); }
public void create_stubs() { StubDocGen = MockRepository.GenerateStub<IDocumentationGenerator>(); StubWriter = MockRepository.GenerateStub<IScreenWriter>(); StubEventAggregator = MockRepository.GenerateStub<IEventAggregator>(); StubEventAggregator.Stub(x => x.GetEvent<WarningEvent>()).Return(new WarningEvent()); StubEventAggregator.Stub(x => x.GetEvent<BadFileEvent>()).Return(new BadFileEvent()); }
public void GenerateDocumentation(IDocumentationGenerator generator) { var shows = new List <string>(); if (ShowGold) { shows.Add($"Gold"); } if (ShowGeneral) { shows.Add($"Age, Clan, Culture, Health"); } if (ShowTopSkills) { shows.Add($"Skills greater than {MinSkillToShow}"); } if (ShowAttributes) { shows.Add($"Attributes"); } if (ShowEquipment) { shows.Add($"Equipment tier"); } if (ShowInventory) { shows.Add($"Battle equipment inventory"); } if (ShowCivilianInventory) { shows.Add($"Civilian equipment inventory"); } if (ShowStorage) { shows.Add($"Custom item storage"); } if (ShowRetinue) { shows.Add($"Retinue count and average tier"); } if (ShowRetinueList) { shows.Add($"Retinue unit list"); } if (ShowAchievements) { shows.Add($"Achievements"); } if (ShowTrackedStats) { shows.Add($"Tracked stats"); } if (ShowPowers) { shows.Add($"Powers"); } generator.PropertyValuePair("Shows", string.Join(", ", shows)); }
public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator, IEventAggregator eventAggregator) { this.screenWriter = screenWriter; this.documentationGenerator = documentationGenerator; this.eventAggregator = eventAggregator; WireUpListeners(); DefineSwitches(); }
public static IDocumentationGenerator PropertyValuePair(this IDocumentationGenerator generator, string property, Action content) { return(generator.Div("value", () => { generator.P($"<strong class=\"value\">{property}</strong>:"); content(); })); }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.PropertyValuePair("Skills", $"{(Auto ? "Automatic, based on class, equipment, and existing skills" : Skills)}"); generator.PropertyValuePair("XP", $"{AmountLow}" + (AmountLow == AmountHigh ? $"" : $" to {AmountHigh}")); if (GoldCost != 0) { generator.PropertyValuePair("Costs", $"{GoldCost}{Naming.Gold}"); } }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.PropertyValuePair("Reflect", $"{ReflectPercent:0}%"); if (ReflectedDamageIsSubtracted) { generator.Value($"Reflected damage is subtracted from incoming damage"); } generator.PropertyValuePair(nameof(HitBehavior).SplitCamelCase(), HitBehavior.ToString()); }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.P(Random ? "Random attribute" : "Provide the attribute name (or part of it) when calling this"); generator.PropertyValuePair("Amount", $"{AmountLow}" + (AmountLow == AmountHigh ? $"" : $" to {AmountHigh}")); if (GoldCost != 0) { generator.P($"Costs {GoldCost}{Naming.Gold}"); } }
public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator, IEventAggregator eventAggregator) { this.screenWriter = screenWriter; this.documentationGenerator = documentationGenerator; this.eventAggregator = eventAggregator; WireUpListeners(); DefineSwitches(); }
private static void AutoDocumentCollection(IDocumentationGenerator generator, IEnumerable obj) { generator.Table(() => { foreach (object o in obj) { generator.TR(() => generator.TD(() => AutoDocument(generator, o))); } }); }
public void Setup() { _generateClassDocs = 0; _generateInterfaceDocs = 0; _generateMethodDocs = 0; _generateConstructorDocs = 0; _generatePropertyDocs = 0; _generateFieldDocs = 0; _generateEnumDocs = 0; _generateStructDocs = 0; _documentationGenerator = Substitute.For <IDocumentationGenerator>(); _documentationGenerator.When(x => x.GenerateClassDocs(Arg.Any <ClassDeclarationSyntax>())).Do(_ => _generateClassDocs++); _documentationGenerator.When(x => x.GenerateInterfaceDocs(Arg.Any <InterfaceDeclarationSyntax>())).Do(_ => _generateInterfaceDocs++); _documentationGenerator.When(x => x.GenerateMethodDocs(Arg.Any <MethodDeclarationSyntax>())).Do(_ => _generateMethodDocs++); _documentationGenerator.When(x => x.GenerateConstructorDocs(Arg.Any <ConstructorDeclarationSyntax>())).Do(_ => _generateConstructorDocs++); _documentationGenerator.When(x => x.GeneratePropertyDocs(Arg.Any <PropertyDeclarationSyntax>())).Do(_ => _generatePropertyDocs++); _documentationGenerator.When(x => x.GenerateFieldDocs(Arg.Any <FieldDeclarationSyntax>())).Do(_ => _generateFieldDocs++); _documentationGenerator.When(x => x.GenerateEnumDocs(Arg.Any <EnumDeclarationSyntax>())).Do(_ => _generateEnumDocs++); _documentationGenerator.When(x => x.GenerateStructDocs(Arg.Any <StructDeclarationSyntax>())).Do(_ => _generateStructDocs++); _xmlDocCreator = new XmlDocCreator(_documentationGenerator); _xmlDocCreator.CreateDocLines(1, "class Test {}"); _xmlDocCreator.CreateDocLines(1, "interface ITest {}"); _xmlDocCreator.CreateDocLines(3, @"class Test { public int Method() { } }"); _xmlDocCreator.CreateDocLines(3, @"class Test { public Test() { } }"); _xmlDocCreator.CreateDocLines(1, "public int Test {get;set;}"); _xmlDocCreator.CreateDocLines(1, "public int Test;"); _xmlDocCreator.CreateDocLines(1, "public enum Test"); _xmlDocCreator.CreateDocLines(1, "public struct Test {}"); }
private static void AutoDocumentObject(IDocumentationGenerator generator, object obj) { var objType = obj.GetType(); var categoryOrders = objType .GetCustomAttributes(inherit: true) .OfType <CategoryOrderAttribute>() .ToList(); var properties = objType.GetProperties() .Select(p => (p, doc: p.GetCustomAttribute <DocumentAttribute>())) .Where(p => p.doc != null) .GroupBy(p => p.p.GetCustomAttribute <CategoryAttribute>()) .OrderBy(g => categoryOrders.FirstOrDefault(c => c.Category == g.Key?.Category)?.Order ?? -int.MaxValue); foreach (var c in properties) { if (c.Key?.Category != null) { generator.H2(c.Key.Category); } generator.Table(() => { var categoryItems = c.OrderBy(p => p.p.GetCustomAttribute <PropertyOrderAttribute>()?.Order ?? -int.MaxValue); foreach (var p in categoryItems) { string name = p.doc?.Name ?? p.p.Name.SplitCamelCase(); string desc = p.doc?.Description ?? p.p.GetCustomAttribute <DescriptionAttribute>()?.Description ?? string.Empty; object value = p.p.GetValue(obj); generator.TR(() => { generator.TD(name); generator.TD(() => { if (value != null) { AutoDocument(generator, value); } }); generator.TD(desc); }); } }); } }
public static void AutoDocument(IDocumentationGenerator generator, object obj) { if (obj is bool b) { generator.P(b ? "Enabled" : "Disabled"); } else if (obj.GetType().IsPrimitive || obj.GetType().IsEnum || obj is string) { generator.P(obj.ToString()); } else if (obj is IEnumerable col) { AutoDocumentCollection(generator, col); } else { AutoDocumentObject(generator, obj); } }
public void GenerateDocumentation(IDocumentationGenerator generator) { if (KnockBackChancePercent > 0) { generator.PropertyValuePair(nameof(KnockBackChancePercent).SplitCamelCase(), $"{KnockBackChancePercent:0}%"); } if (KnockDownChancePercent > 0) { generator.PropertyValuePair(nameof(KnockDownChancePercent).SplitCamelCase(), $"{KnockDownChancePercent:0}%"); } if (ShrugOffChancePercent > 0) { generator.PropertyValuePair(nameof(ShrugOffChancePercent).SplitCamelCase(), $"{ShrugOffChancePercent:0}%"); } if (MakesRearChancePercent > 0) { generator.PropertyValuePair(nameof(MakesRearChancePercent).SplitCamelCase(), $"{MakesRearChancePercent:0}%"); } if (DismountChance > 0) { generator.PropertyValuePair(nameof(DismountChance).SplitCamelCase(), $"{DismountChance:0}%"); } }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.PropertyValuePair("Side", OnPlayerSide ? "Streamers side" : "Enemy side"); if (HealPerSecond > 0) { generator.PropertyValuePair("Heals", $"{HealPerSecond:0.0}HP per second while summoned"); } if (GoldCost > 0) { generator.PropertyValuePair("Cost", $"{GoldCost}{Naming.Gold}"); } var allowed = new List <string>(); if (AllowFieldBattle) { allowed.Add("Field battle"); } if (AllowVillageBattle) { allowed.Add("Village battle"); } if (AllowSiegeBattle) { allowed.Add("Siege battle"); } if (AllowFriendlyMission) { allowed.Add("Friendly mission"); } if (AllowHideOut) { allowed.Add("Hide-out"); } generator.PropertyValuePair("Allowed in", $"{string.Join(", ", allowed)}"); }
public static IDocumentationGenerator PropertyValuePair(this IDocumentationGenerator generator, string property, string value) { return(generator.Div("value", () => generator.P($"<strong class=\"value\">{property}</strong>: {value}"))); }
public void GenerateDocumentation(IDocumentationGenerator generator) => generator.P(Description);
public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator) { this.screenWriter = screenWriter; this.documentationGenerator = documentationGenerator; this.documentationGenerator.BadFileEvent += documentationGenerator_BadFileEvent; }
public MainWindow() { InitializeComponent(); facade = new DocumentationGenerator(); rbTypeMember = rbTrainee; }
public static IDocumentationGenerator Value(this IDocumentationGenerator generator, Action content) { return(generator.Div("value", content)); }
public CommandsController(IIDEExplorer ideExplorer, IDocumentationGenerator generator) { _ideExplorer = ideExplorer; _generator = generator; }
public static IDocumentationGenerator Value(this IDocumentationGenerator generator, string value) { return(generator.P("value", value)); }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.PropertyValuePair("Damage", $"{DamageModifierPercent:0}%"); generator.PropertyValuePair(nameof(AddHitBehavior).SplitCamelCase(), () => AddHitBehavior.GenerateDocumentation(generator)); generator.PropertyValuePair(nameof(RemoveHitBehavior).SplitCamelCase(), () => RemoveHitBehavior.GenerateDocumentation(generator)); }
/// <summary> /// Initializes a new instance of the <see cref="XmlDocCreator"/> class. /// </summary> /// <param name="documentationGenerator">The documentation generator.</param> public XmlDocCreator(IDocumentationGenerator documentationGenerator) { _documentationGenerator = documentationGenerator ?? throw new ArgumentNullException(nameof(documentationGenerator)); }
public void create_stubs() { StubDocGen = MockRepository.GenerateStub<IDocumentationGenerator>(); }
public void GenerateDocumentation(IDocumentationGenerator generator) { Retinue.GenerateDocumentation(generator); }
public CommandsController(IIdeEnvironment ide, IDocumentationGenerator generator) { _ide = ide; _generator = generator; }
public void GenerateDocumentation(IDocumentationGenerator generator) { generator.PropertyValuePair("Amount", $"{Amount}{Naming.Gold}"); }