Esempio n. 1
0
 public void SubtotalTest(string s, GatheringType gt, params SubtotalLevel[] levels)
 => PairedSucc <ISubtotal>(nameof(ParsingF.Subtotal), s,
                           r =>
 {
     Assert.Equal(gt, r.GatherType);
     Assert.True(levels.SequenceEqual(r.Levels));
 });
Esempio n. 2
0
 public void GroupedQueryTest(string s, GatheringType gt, params SubtotalLevel[] levels)
 => PairedSucc <IGroupedQuery>(nameof(ParsingF.GroupedQuery), s,
                               r =>
 {
     Assert.NotNull(r.VoucherEmitQuery.VoucherQuery);
     Assert.Equal(gt, r.Subtotal.GatherType);
     Assert.True(levels.SequenceEqual(r.Subtotal.Levels));
 });
Esempio n. 3
0
 public static GatheringType ToGroup(this GatheringType type)
 {
     return(type switch
     {
         GatheringType.Mining => GatheringType.Miner,
         GatheringType.Quarrying => GatheringType.Miner,
         GatheringType.Miner => GatheringType.Miner,
         GatheringType.Logging => GatheringType.Botanist,
         GatheringType.Harvesting => GatheringType.Botanist,
         GatheringType.Botanist => GatheringType.Botanist,
         GatheringType.Spearfishing => GatheringType.Fisher,
         _ => type,
     });
 /// <inheritdoc />
 public string PresentSubtotal(ISubtotalResult raw, ISubtotal par, IEntitiesSerializer serializer)
 {
     m_Par      = par;
     Ga         = par.GatherType;
     Cu         = par.EquivalentCurrency;
     Serializer = serializer;
     Sb         = new StringBuilder();
     Depth      = 0;
     Pre();
     raw?.Accept(this);
     Post();
     return(Sb.ToString());
 }
 /// <inheritdoc />
 public async IAsyncEnumerable <string> PresentSubtotal(ISubtotalResult raw, ISubtotal par,
                                                        IEntitiesSerializer serializer)
 {
     m_Par      = par;
     Ga         = par.GatherType;
     Cu         = par.EquivalentCurrency;
     Serializer = serializer;
     Depth      = 0;
     await foreach (var s in Pre())
     {
         yield return(s);
     }
     if (raw != null)
     {
         await foreach (var s in raw.Accept(this))
         {
             yield return(s);
         }
     }
     await foreach (var s in Post())
     {
         yield return(s);
     }
 }
Esempio n. 6
0
 public bool IsBotanist()
 => GatheringType.ToGroup() == GatheringType.Botanist;
Esempio n. 7
0
 public bool IsMiner()
 => GatheringType.ToGroup() == GatheringType.Miner;