Compare commits
2 commits
72582fb703
...
b6cf0b6d5c
Author | SHA1 | Date | |
---|---|---|---|
b6cf0b6d5c | |||
443789c391 |
33 changed files with 87 additions and 76 deletions
|
@ -1,4 +1,5 @@
|
|||
root = true
|
||||
|
||||
["*"]
|
||||
charset = "utf-8"
|
||||
csharp_new_line_before_members_in_object_initializers = false
|
||||
|
@ -104,7 +105,8 @@ tab_width = 4
|
|||
["*.md"]
|
||||
max_line_length = "off"
|
||||
|
||||
["*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]"]
|
||||
["*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
||||
"]
|
||||
indent_size = 2
|
||||
indent_style = "space"
|
||||
tab_width = 2
|
||||
|
|
|
@ -40,8 +40,7 @@ public class ConfigCommand : Command, ICommandHandler, ITopCommand
|
|||
public Task<int> InvokeAsync(InvocationContext context)
|
||||
{
|
||||
// Get the settings and report that it was being created.
|
||||
ConfigCommandSettings settings =
|
||||
this.service.ReadDefaultConfigFile<ConfigCommandSettings>();
|
||||
var settings = this.service.ReadDefaultConfigFile<ConfigCommandSettings>();
|
||||
|
||||
if (settings == null)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,9 @@ public class SampleToolModule : Module
|
|||
};
|
||||
|
||||
// Add in the top-level commands.
|
||||
var commandList = c.Resolve<IList<ITopCommand>>().Cast<Command>().ToList();
|
||||
List<Command> commandList = c.Resolve<IList<ITopCommand>>()
|
||||
.Cast<Command>()
|
||||
.ToList();
|
||||
|
||||
if (commandList.Count == 0)
|
||||
{
|
||||
|
|
|
@ -38,8 +38,7 @@ public class GemtextPipeTableExtension : IMarkdownExtension
|
|||
pipeline.BlockParsers.Insert(0, new PipeTableBlockParser());
|
||||
}
|
||||
|
||||
LineBreakInlineParser? lineBreakParser =
|
||||
pipeline.InlineParsers.FindExact<LineBreakInlineParser>();
|
||||
var lineBreakParser = pipeline.InlineParsers.FindExact<LineBreakInlineParser>();
|
||||
|
||||
if (!pipeline.InlineParsers.Contains<PipeTableParser>())
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public class IncreaseHeaderDepthsAfterFirst : IMarkdownExtension
|
|||
return;
|
||||
}
|
||||
|
||||
HeadingRenderer? heading = gemtext.ObjectRenderers.Find<HeadingRenderer>();
|
||||
var heading = gemtext.ObjectRenderers.Find<HeadingRenderer>();
|
||||
|
||||
if (heading != null)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ public class WikiLinkExtension : IMarkdownExtension
|
|||
/// <inheritdoc />
|
||||
public void Setup(MarkdownPipelineBuilder pipeline)
|
||||
{
|
||||
WikiLinkInlineParser? parser = pipeline.InlineParsers.FindExact<WikiLinkInlineParser>();
|
||||
var parser = pipeline.InlineParsers.FindExact<WikiLinkInlineParser>();
|
||||
|
||||
if (parser != null)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ public partial class CreateCalender : OperationBase
|
|||
calendar.TimeZones.Add(new VTimeZone(this.clock.DateTimeZone.Id));
|
||||
|
||||
// Go through the events and add all of them.
|
||||
var input = entities.ToList();
|
||||
List<Entity>? input = entities.ToList();
|
||||
IEnumerable<CalendarEvent> events = input.Select(this.CreateCalendarEvent);
|
||||
|
||||
calendar.Events.AddRange(events);
|
||||
|
@ -89,7 +89,7 @@ public partial class CreateCalender : OperationBase
|
|||
|
||||
private CalendarEvent CreateCalendarEvent(Entity entity)
|
||||
{
|
||||
Instant instant = entity.Get<Instant>();
|
||||
var instant = entity.Get<Instant>();
|
||||
var when = this.clock.ToDateTime(instant);
|
||||
string summary = this.GetEventSummary!(entity);
|
||||
Uri? url = this.GetEventUrl?.Invoke(entity);
|
||||
|
|
|
@ -72,7 +72,7 @@ public abstract class ClassAttributeSyntaxReceiverBase : ISyntaxReceiver
|
|||
}
|
||||
|
||||
// See if the class has our set properties attribute.
|
||||
var attributes = cds.AttributeLists.AsEnumerable()
|
||||
List<string>? attributes = cds.AttributeLists.AsEnumerable()
|
||||
.SelectMany(x => x.Attributes)
|
||||
.Select(x => x.Name.ToString())
|
||||
.ToList();
|
||||
|
|
|
@ -88,7 +88,7 @@ public class SingletonComponentSourceGenerator
|
|||
);
|
||||
|
||||
// Create the source text and write out the file.
|
||||
var sourceText = SourceText.From(buffer.ToString(), Encoding.UTF8);
|
||||
SourceText? sourceText = SourceText.From(buffer.ToString(), Encoding.UTF8);
|
||||
context.AddSource(cls + ".Generated.cs", sourceText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class WithPropertiesSourceGenerator
|
|||
buffer.AppendLine("}");
|
||||
|
||||
// Create the source text and write out the file.
|
||||
var sourceText = SourceText.From(buffer.ToString(), Encoding.UTF8);
|
||||
SourceText? sourceText = SourceText.From(buffer.ToString(), Encoding.UTF8);
|
||||
context.AddSource(cds.Identifier + ".Generated.cs", sourceText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public partial class ReadFiles : FileSystemOperationBase
|
|||
// Read the files from the file system.
|
||||
this.validator.ValidateAndThrow(this);
|
||||
|
||||
var glob = Glob.Parse(this.Pattern);
|
||||
Glob? glob = Glob.Parse(this.Pattern);
|
||||
|
||||
IEnumerable<FileEntry> files = this.FileSystem.EnumerateFileEntries(
|
||||
"/",
|
||||
|
|
|
@ -3,7 +3,6 @@ using MfGames.Gallium;
|
|||
using MfGames.Nitride.Entities;
|
||||
using MfGames.Nitride.Generators;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Zio;
|
||||
|
||||
namespace MfGames.Nitride.IO.Paths;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class StatusPipelineCommandLineOption : IPipelineCommandOption
|
|||
return;
|
||||
}
|
||||
|
||||
SpectreDisplayMode mode = value.GetEnumFuzzy<SpectreDisplayMode>("status display mode");
|
||||
var mode = value.GetEnumFuzzy<SpectreDisplayMode>("status display mode");
|
||||
|
||||
this.observer.DisplayMode = mode;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public partial class IndexedPathRegexSchedule<TSchedule> : PathRegexScheduleBase
|
|||
protected override Entity Apply(Entity entity, int number, TimeService timeService)
|
||||
{
|
||||
// Figure out the entry in the index.
|
||||
var applicableKeys = this.Indexes.Keys.Where(a => a <= number).ToList();
|
||||
List<int>? applicableKeys = this.Indexes.Keys.Where(a => a <= number).ToList();
|
||||
|
||||
if (applicableKeys.Count == 0)
|
||||
{
|
||||
|
|
|
@ -53,16 +53,17 @@ public partial class IndexedSchedule
|
|||
|
||||
// If the time hasn't past, then we don't apply it.
|
||||
Instant now = timeService.Clock.GetCurrentInstant();
|
||||
bool isFuture = instant > now;
|
||||
|
||||
return instant > now ? entity : this.Apply(entity, number, instant);
|
||||
return this.Apply(entity, number, instant, isFuture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the schedule to the entity based on the number and instant
|
||||
/// given.
|
||||
/// </summary>
|
||||
protected virtual Entity Apply(Entity entity, int number, Instant instant)
|
||||
protected virtual Entity Apply(Entity entity, int number, Instant instant, bool isFuture)
|
||||
{
|
||||
return entity.Set(instant);
|
||||
return !isFuture ? entity.Set(instant) : entity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public partial class CreateDateIndexes : OperationBase, IResolvingOperation
|
|||
|
||||
// Go through the inputs and group each one. We also use `ToList` to force the enumeration to completely
|
||||
// resolve and we can get everything we need. We will append the created indexes to the end of this list.
|
||||
var output = input
|
||||
List<Entity>? output = input
|
||||
.SelectEntity<Instant>(
|
||||
(entity, instant) => this.GroupOnFormats(instant, entries, entity)
|
||||
)
|
||||
|
@ -87,9 +87,9 @@ public partial class CreateDateIndexes : OperationBase, IResolvingOperation
|
|||
|
||||
// Get all the entities at this level and split them into ones we've seen (at a lower level) and which
|
||||
// ones are new (these always go on the index).
|
||||
var seenEntities = pair.Value.Where(a => seen.Contains(a)).ToList();
|
||||
List<Entity>? seenEntities = pair.Value.Where(a => seen.Contains(a)).ToList();
|
||||
|
||||
var newEntities = pair.Value.Where(a => !seen.Contains(a)).ToList();
|
||||
List<Entity>? newEntities = pair.Value.Where(a => !seen.Contains(a)).ToList();
|
||||
|
||||
seen.AddRange(newEntities);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class DatePipelineCommandOption : IPipelineCommandOption
|
|||
{
|
||||
// We have a date, so we need to create a fake clock that has this
|
||||
// date for the entire run.
|
||||
var local = LocalDateTime.FromDateTime(value.Value);
|
||||
LocalDateTime local = LocalDateTime.FromDateTime(value.Value);
|
||||
ZonedDateTime zoned = local.InZoneStrictly(this.timeService.DateTimeZone);
|
||||
var instant = zoned.ToInstant();
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ public static class NitrideTemporalBuilderExtensions
|
|||
{
|
||||
x.Register(context =>
|
||||
{
|
||||
ILogger logger = context.Resolve<ILogger>();
|
||||
TimeService clock = context.Resolve<TimeService>();
|
||||
var logger = context.Resolve<ILogger>();
|
||||
var clock = context.Resolve<TimeService>();
|
||||
|
||||
return new ExpiresPipelineCommandOption(logger, clock, config.Expiration);
|
||||
})
|
||||
|
@ -60,8 +60,8 @@ public static class NitrideTemporalBuilderExtensions
|
|||
builder.ConfigureSite(
|
||||
(_, scope) =>
|
||||
{
|
||||
ILogger logger = scope.Resolve<ILogger>();
|
||||
TimeService timeService = scope.Resolve<TimeService>();
|
||||
var logger = scope.Resolve<ILogger>();
|
||||
var timeService = scope.Resolve<TimeService>();
|
||||
|
||||
timeService.DateTimeZone = config.DateTimeZone;
|
||||
logger.Verbose("Setting time zone to {Zone:l}", timeService.DateTimeZone);
|
||||
|
|
|
@ -89,7 +89,7 @@ public class TimeService
|
|||
/// <returns>An instant representing this DateTimeOffset.</returns>
|
||||
public Instant CreateInstant(DateTimeOffset when)
|
||||
{
|
||||
var offset = OffsetDateTime.FromDateTimeOffset(when);
|
||||
OffsetDateTime offset = OffsetDateTime.FromDateTimeOffset(when);
|
||||
|
||||
return offset.ToInstant();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class TimeService
|
|||
{
|
||||
if (when.Kind == DateTimeKind.Unspecified)
|
||||
{
|
||||
var localDate = LocalDate.FromDateTime(when);
|
||||
LocalDate localDate = LocalDate.FromDateTime(when);
|
||||
|
||||
return this.CreateInstant(localDate);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public class ConfigToolService
|
|||
}
|
||||
|
||||
string json = file.ReadAllText();
|
||||
TType result = JsonConvert.DeserializeObject<TType>(json)!;
|
||||
var result = JsonConvert.DeserializeObject<TType>(json)!;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public static class ParseResultExtensions
|
|||
return new List<string>();
|
||||
}
|
||||
|
||||
var values = optionValues
|
||||
List<string>? values = optionValues
|
||||
.Split(',')
|
||||
.Select(x => x.Trim())
|
||||
.SelectMany(x => x.Split(' '))
|
||||
|
|
|
@ -42,7 +42,7 @@ public static class StringCliExtensions
|
|||
public static Result<string> GetFuzzy(this string value, ICollection<string> possible)
|
||||
{
|
||||
// Look for a direct match.
|
||||
var found = possible
|
||||
List<string>? found = possible
|
||||
.Where(x => string.Equals(x, value, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
|
@ -107,7 +107,7 @@ public static class StringCliExtensions
|
|||
}
|
||||
|
||||
// Attempt a fuzzy search.
|
||||
var possible = Enum.GetNames(typeof(TEnum))
|
||||
List<string>? possible = Enum.GetNames(typeof(TEnum))
|
||||
.Select(e => e.ToLower())
|
||||
.Where(e => e.StartsWith(input.ToLower()))
|
||||
.ToList();
|
||||
|
|
|
@ -127,7 +127,7 @@ public class LoggingToolService
|
|||
nameof(LogContextFormat.Class)
|
||||
);
|
||||
|
||||
LogContextFormat format = level.GetEnumFuzzy<LogContextFormat>("log context format");
|
||||
var format = level.GetEnumFuzzy<LogContextFormat>("log context format");
|
||||
|
||||
return format;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class LoggingToolService
|
|||
"Warning"
|
||||
);
|
||||
|
||||
LogEventLevel logLevel = level.GetEnumFuzzy<LogEventLevel>("log level");
|
||||
var logLevel = level.GetEnumFuzzy<LogEventLevel>("log level");
|
||||
|
||||
return logLevel;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class AddPathPrefixTest : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/c1.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
AddPathPrefix op = context.Resolve<AddPathPrefix>().WithPathPrefix("/prefix");
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MfGames.Gallium;
|
||||
using MfGames.Nitride.IO.Contents;
|
||||
using MfGames.Nitride.IO.Paths;
|
||||
using MfGames.Nitride.Tests;
|
||||
|
@ -36,11 +37,13 @@ public class DirectChildPathScannerTests : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/a/d/e/index.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
DirectChildPathScanner op = context.Resolve<DirectChildPathScanner>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
var op = context.Resolve<DirectChildPathScanner>();
|
||||
|
||||
// Read and replace the paths.
|
||||
var _ = NitrideOperationExtensions.Run(readFiles.WithPattern("/**").Run(), op).ToList();
|
||||
List<Entity>? _ = NitrideOperationExtensions
|
||||
.Run(readFiles.WithPattern("/**").Run(), op)
|
||||
.ToList();
|
||||
|
||||
KeyValuePair<string, string[]>[] actual = op.GetScannedResults()
|
||||
.ToDictionary(x => x.Key, x => x.Value.Select(y => y.Get<UPath>().ToString()).ToArray())
|
||||
|
|
|
@ -27,7 +27,7 @@ public class GetEntityByPathTests : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/c1.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
// Read and replace the paths.
|
||||
IOrderedEnumerable<string> output = NitrideIOEnumerableEntityExtensions
|
||||
|
@ -55,7 +55,7 @@ public class GetEntityByPathTests : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/c1.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
// Read and replace the paths.
|
||||
IOrderedEnumerable<string> output = NitrideIOEnumerableEntityExtensions
|
||||
|
@ -88,7 +88,7 @@ public class GetEntityByPathTests : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/c1.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
// Read and replace the paths.
|
||||
IOrderedEnumerable<string> output = NitrideIOEnumerableEntityExtensions
|
||||
|
|
|
@ -37,8 +37,8 @@ public class LinkDirectChildrenTests : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/a/d/e/index.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
DirectChildPathScanner scanner = context.Resolve<DirectChildPathScanner>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
var scanner = context.Resolve<DirectChildPathScanner>();
|
||||
|
||||
CreateOrUpdateIndex op = context.Resolve<LinkDirectChildren>().WithScanner(scanner);
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ public class MoveToIndexPathsTest : NitrideIOTestBase
|
|||
CreateFileSystem(context);
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
MoveToIndexPath op = context.Resolve<MoveToIndexPath>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
var op = context.Resolve<MoveToIndexPath>();
|
||||
|
||||
// Read and replace the paths.
|
||||
IOrderedEnumerable<string> output = NitrideOperationExtensions
|
||||
|
@ -43,7 +43,7 @@ public class MoveToIndexPathsTest : NitrideIOTestBase
|
|||
CreateFileSystem(context);
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
MoveToIndexPath op = context
|
||||
.Resolve<MoveToIndexPath>()
|
||||
|
|
|
@ -27,7 +27,7 @@ public class RemovePathPrefixTest : NitrideIOTestBase
|
|||
fileSystem.CreateFile("/a/a/c1.md");
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
RemovePathPrefix op = context.Resolve<RemovePathPrefix>().WithPathPrefix("/a");
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class WhereNotIgnoredTests : NitrideIOTestBase
|
|||
var ignore = new IgnoreList(new[] { "*.txt" });
|
||||
|
||||
// Set up the operation.
|
||||
ReadFiles readFiles = context.Resolve<ReadFiles>();
|
||||
var readFiles = context.Resolve<ReadFiles>();
|
||||
|
||||
// Read and replace the paths.
|
||||
IOrderedEnumerable<string> output = NitrideIOEnumerableEntityExtensions
|
||||
|
|
|
@ -23,7 +23,7 @@ public class MakeSingleLinkListItemsTests : TestBase<MarkdownTestContext>
|
|||
|
||||
List<Entity> input =
|
||||
new() { new Entity().Set(IsMarkdown.Instance).SetTextContent("- [Empty](link)"), };
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
|
@ -40,30 +40,13 @@ public class MakeSingleLinkListItemsTests : TestBase<MarkdownTestContext>
|
|||
{
|
||||
new Entity().Set(IsMarkdown.Instance).SetTextContent("- [Empty](link) space"),
|
||||
};
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
Assert.Equal("- [Empty space](link)", content);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtendSingleMarkdownLinkStar()
|
||||
{
|
||||
using MarkdownTestContext context = this.CreateContext();
|
||||
|
||||
List<Entity> input =
|
||||
new()
|
||||
{
|
||||
new Entity().Set(IsMarkdown.Instance).SetTextContent("* [Empty](link) space"),
|
||||
};
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
Assert.Equal("* [Empty space](link)", content);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtendSingleMarkdownLinkSpaces()
|
||||
{
|
||||
|
@ -75,13 +58,30 @@ public class MakeSingleLinkListItemsTests : TestBase<MarkdownTestContext>
|
|||
{
|
||||
new Entity().Set(IsMarkdown.Instance).SetTextContent("- [Empty](link) space"),
|
||||
};
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
Assert.Equal("- [Empty space](link)", content);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtendSingleMarkdownLinkStar()
|
||||
{
|
||||
using MarkdownTestContext context = this.CreateContext();
|
||||
|
||||
List<Entity> input =
|
||||
new()
|
||||
{
|
||||
new Entity().Set(IsMarkdown.Instance).SetTextContent("* [Empty](link) space"),
|
||||
};
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
Assert.Equal("* [Empty space](link)", content);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NoLinksNoChange()
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ public class MakeSingleLinkListItemsTests : TestBase<MarkdownTestContext>
|
|||
|
||||
List<Entity> input =
|
||||
new() { new Entity().Set(IsMarkdown.Instance).SetTextContent("- Empty"), };
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class MakeSingleLinkListItemsTests : TestBase<MarkdownTestContext>
|
|||
.Set(IsMarkdown.Instance)
|
||||
.SetTextContent("- [Empty](link) [space](link2)"),
|
||||
};
|
||||
MakeSingleLinkListItems? op = context.Resolve<MakeSingleLinkListItems>();
|
||||
var op = context.Resolve<MakeSingleLinkListItems>();
|
||||
IEnumerable<Entity> output = op.Run(input);
|
||||
string content = output.First().GetTextContentString()!.Trim();
|
||||
|
||||
|
|
|
@ -237,10 +237,16 @@ public class IndexedPathRegexScheduleTest : TemporalSchedulesTestBase
|
|||
public string? Access { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Entity Apply(Entity entity, int number, Instant instant)
|
||||
protected override Entity Apply(Entity entity, int number, Instant instant, bool isFuture)
|
||||
{
|
||||
if (isFuture)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
TestModel model = entity.Get<TestModel>();
|
||||
model.Access = this.Access;
|
||||
|
||||
return entity.SetAll(instant, model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class TextContentYamlTests : NitrideTestBase
|
|||
public void NoTextContent()
|
||||
{
|
||||
Entity entity = new();
|
||||
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
||||
var output = entity.GetTextContentYaml<TestContent>();
|
||||
|
||||
Assert.Null(output);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class TextContentYamlTests : NitrideTestBase
|
|||
public void SetAndGetContent()
|
||||
{
|
||||
Entity entity = new Entity().SetTextContentYaml(new TestContent { Value = "t1" });
|
||||
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
||||
var output = entity.GetTextContentYaml<TestContent>();
|
||||
|
||||
Assert.NotNull(output);
|
||||
Assert.Equal("t1", output.Value);
|
||||
|
@ -35,7 +35,7 @@ public class TextContentYamlTests : NitrideTestBase
|
|||
Entity entity = new Entity()
|
||||
.SetTextContentYaml(new TestContent { Value = "t1" })
|
||||
.SetTextContentYaml<TestContent>(null);
|
||||
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
||||
var output = entity.GetTextContentYaml<TestContent>();
|
||||
|
||||
Assert.Null(output);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue