Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoh committed Oct 22, 2023
1 parent 29fc0e4 commit a9dec1c
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion RecordParser.Benchmark/VariableLengthWriterBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using FlatFiles;
using FlatFiles.TypeMapping;
using RecordParser.Builders.Writer;
using RecordParser.Extensions.FileWriter;
using RecordParser.Extensions;
using SoftCircuits.CsvParser;
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion RecordParser.Test/FileReaderTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using FluentAssertions;
using MoreLinq;
using RecordParser.Builders.Reader;
using RecordParser.Extensions.FileReader;
using RecordParser.Extensions;
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down
3 changes: 1 addition & 2 deletions RecordParser.Test/FileWriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
using MoreLinq;
using RecordParser.Builders.Reader;
using RecordParser.Builders.Writer;
using RecordParser.Extensions.FileReader;
using RecordParser.Extensions.FileWriter;
using RecordParser.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
35 changes: 35 additions & 0 deletions RecordParser.Test/NamespaceTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using FluentAssertions;
using RecordParser.Extensions;
using System;
using System.Linq;
using Xunit;

namespace RecordParser.Test
{
public class NamespaceTest : TestSetup
{
[Fact]
public void Given_public_types_inside_extensions_folder_should_not_have_namespaces_referencing_subfolder()
{
// Arrange

bool IsDelegate(Type type) => typeof(Delegate).IsAssignableFrom(type.BaseType);

var location = "RecordParser.Extensions";
var types = typeof(WriterExtensions)
.Assembly
.GetTypes()
.Where(x => x.IsPublic && IsDelegate(x) is false)
.Where(x => x.Namespace.StartsWith(location))
.ToArray();

// Act

var typesDifferentLocation = types.Where(x => x.Namespace != location);

// Assert

typesDifferentLocation.Should().BeEmpty();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using static RecordParser.Extensions.FileReader.ReaderCommon;
using static RecordParser.Extensions.ReaderCommon;

namespace RecordParser.Extensions.FileReader
namespace RecordParser.Extensions
{
public class FixedLengthReaderOptions<T>
{
Expand Down
2 changes: 1 addition & 1 deletion RecordParser/Extensions/FileReader/ReaderCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Threading;

namespace RecordParser.Extensions.FileReader
namespace RecordParser.Extensions
{
public class ParallelismOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using static RecordParser.Extensions.FileReader.ReaderCommon;
using static RecordParser.Extensions.ReaderCommon;

namespace RecordParser.Extensions.FileReader
namespace RecordParser.Extensions
{
public class VariableLengthReaderOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static RecordParser.Extensions.FileReader.ReaderCommon;
using static RecordParser.Extensions.ReaderCommon;

namespace RecordParser.Extensions.FileReader
namespace RecordParser.Extensions
{
public delegate string StringPool(ReadOnlySpan<char> text);
internal delegate void Get(ref TextFindHelper finder, string[] inst, StringPool cache);
Expand Down
4 changes: 1 addition & 3 deletions RecordParser/Extensions/FileWriter/WriterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System.IO;
using System.Linq;

namespace RecordParser.Extensions.FileWriter
namespace RecordParser.Extensions
{
using RecordParser.Extensions.FileReader;

/// <summary>
/// Delegate representing object to text convert method.
/// </summary>
Expand Down

0 comments on commit a9dec1c

Please sign in to comment.