public LineRenderDescriptor(ILineSource lineSource, double widthInFeet, Texture2D texture, bool outerOnly = false) { this.lineSource = lineSource; this.widthInFeet = widthInFeet; this.texture = texture; this.outerOnly = outerOnly; }
public BuildingRenderDescriptor(IPolygonSource polygonSource, double heightInFeet, Color roofColor, Texture2D wallTexture) { this.polygonSource = polygonSource; this.lineSource = new EdgeLineSource(polygonSource, true); this.heightInFeet = heightInFeet; this.roofColor = roofColor; this.wallTexture = wallTexture; }
public CsvParser(ILineSource lineSource, ILoggerFactory loggerFactory) { LineSource = lineSource ?? throw new ArgumentNullException(nameof(lineSource)); if (loggerFactory is null) { throw new ArgumentNullException(nameof(loggerFactory)); } Logger = loggerFactory.CreateLogger <CsvParser>(); }
public void ReturnsEmptyOnFailureFromAttributeSource(ILineSource lineSource) { // Arrange // Act IEnumerable <string> lines = lineSource.GetLines(); // Assert Assert.IsFalse(lines.Any()); }
public void ReturnsEmptyOnFailure() { // Arrange ILineSource lineSource = GetLineSourceWithoutData(); // Act IEnumerable <string> lines = lineSource.GetLines(); // Assert Assert.IsFalse(lines.Any()); }
public void CanRetrieveValidData() { // Arrange string[] csvLines = { "first,second,third", "1,2,3" }; ILineSource lineSource = GetLineSourceWithData(csvLines); // Act string[] lines = lineSource.GetLines().ToArray(); // Assert CollectionAssert.AreEqual(csvLines, lines); }
public void CanReadCsvData() { // Arrange var lineSourceMock = new Mock <ILineSource>(); lineSourceMock .Setup(x => x.GetLines()) .Returns(new[] { "first,second,third", "1,2,3" }); ILineSource lineSource = lineSourceMock.Object; var parser = new CsvParser(lineSource); // Act List <string[]> parsedRows = parser.Parse().ToList(); // Assert TestContext.WriteLine($"Found {parsedRows.Count} rows"); Assert.AreEqual(2, parsedRows.Count); CollectionAssert.AreEqual(new[] { "first", "second", "third" }, parsedRows[0]); CollectionAssert.AreEqual(new[] { "1", "2", "3" }, parsedRows[1]); lineSourceMock.Verify(x => x.GetLines(), Times.Once()); }
private int ReadScript(ILineSource linesource) { try { while (true) { string s; s = linesource.ReadLine(); if (s == null) { break; } Collect(s); } } catch (Exception) { ConsoleSurrogate.WriteLine("There was a problem reading the script file."); ConsoleSurrogate.WriteLine("Tried " + linesource.ToString()); return(1); } return(0); }
public CsvParser(ILineSource lineSource) { LineSource = lineSource ?? throw new ArgumentNullException(nameof(lineSource)); }
public WhitespaceRemovalLineSource(ILineSource source) { this.source = source; }
public CsvParser(ILineSource lineSource, IAsyncLogger logger) { LineSource = lineSource ?? throw new ArgumentNullException(nameof(lineSource)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); LineSource.ErrorOccured += LineSource_ErrorOccured; }
public LineRenderDescriptor(ILineSource lineSource, double widthInFeet, Color color) { this.lineSource = lineSource; this.widthInFeet = widthInFeet; this.color = color; }
public void Assemble(ILineSource lineSource) { parser.ParseAllLines(lineSource); CodeGenerator.GenerateCode(parser.Instructions); }
public ElizaMain(ILineSource linesource) { ReadScript(linesource); }
private int ReadScript(ILineSource linesource) { try { while (true) { string s; s = linesource.ReadLine(); if (s == null) { break; } Collect(s); } } catch (Exception) { ConsoleSurrogate.WriteLine("There was a problem reading the script file."); ConsoleSurrogate.WriteLine("Tried " + linesource.ToString()); return 1; } return 0; }
public CommentStrippingLineSource(ILineSource source) { this.source = source; }
public ElizaMain(ILineSource linesource) => ReadScript(linesource);
bool TryInsertLine(SortedDictionary <ProblemString, List <ILineSource> > tree, ILineSource source) { if (!source.TryReadLine(out ProblemString line)) { return(false); } if (!tree.TryGetValue(line, out List <ILineSource> readers)) { readers = new List <ILineSource>(1); tree.Add(line, readers); } readers.Add(source); return(true); }