Skip to content

Commit

Permalink
Merge pull request #50 from broderickt2/Cleanup
Browse files Browse the repository at this point in the history
Cleanup Code
  • Loading branch information
myquay authored Oct 21, 2023
2 parents 929c3a8 + 2849359 commit 2493010
Show file tree
Hide file tree
Showing 31 changed files with 50 additions and 147 deletions.
9 changes: 1 addition & 8 deletions src/JsonPatch.Common/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch
namespace JsonPatch
{
/// <summary>
/// Constants
Expand Down Expand Up @@ -35,7 +29,6 @@ public static class Operations
/// Moves a value from one location to the other.
/// </summary>
public const string MOVE = "move";

}
}
}
1 change: 0 additions & 1 deletion src/JsonPatch.Common/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ internal static class StringExtensions
{
internal static bool IsPositiveInteger(this string @string)
{

bool isInteger = Int32.TryParse(@string, out int n);

if (!isInteger)
Expand Down
4 changes: 0 additions & 4 deletions src/JsonPatch.Common/JsonPatchException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch
{
Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch.Common/JsonPatchOperationType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch
namespace JsonPatch
{
/// <summary>
/// Json Patch Operation Type
Expand Down
4 changes: 0 additions & 4 deletions src/JsonPatch.Common/JsonPatchParseException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch
{
Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch.Common/Model/PatchOperation.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Model
namespace JsonPatch.Model
{
/// <summary>
/// JSON Patch Operation
Expand Down
2 changes: 0 additions & 2 deletions src/JsonPatch.Common/Paths/IValueConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JsonPatch.Paths
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Paths.Resolvers
{
Expand All @@ -18,7 +15,8 @@ public class AttributePropertyPathResolver : BaseResolver
/// </summary>
/// <param name="converter"></param>
public AttributePropertyPathResolver(IValueConverter converter) : base(converter)
{ }
{
}

/// <summary>
/// Get the property based on the component name
Expand Down
1 change: 0 additions & 1 deletion src/JsonPatch.Common/Paths/Resolvers/BaseResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace JsonPatch.Paths.Resolvers
/// </summary>
public abstract class BaseResolver : IPathResolver
{

private readonly IValueConverter converter;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Reflection;

namespace JsonPatch.Paths.Resolvers
Expand All @@ -14,7 +13,8 @@ public class CaseInsensitivePropertyPathResolver : BaseResolver
/// </summary>
/// <param name="converter"></param>
public CaseInsensitivePropertyPathResolver(IValueConverter converter) : base(converter)
{ }
{
}

/// <summary>
/// Get property info from parent type (case insensitive)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Reflection;

namespace JsonPatch.Paths.Resolvers
Expand All @@ -14,7 +13,8 @@ public class ExactCasePropertyPathResolver : BaseResolver
/// </summary>
/// <param name="converter"></param>
public ExactCasePropertyPathResolver(IValueConverter converter) : base(converter)
{ }
{
}

/// <summary>
/// Returns the property info for the given component (case sensitive)
Expand Down
4 changes: 0 additions & 4 deletions src/JsonPatch.Common/Paths/Resolvers/FlexiblePathResolver.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Paths.Resolvers
{
Expand Down
1 change: 0 additions & 1 deletion src/JsonPatch.Common/Paths/Resolvers/IPathResolver.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using JsonPatch.Paths.Components;
using System;


namespace JsonPatch.Paths.Resolvers
{
/// <summary>
Expand Down
11 changes: 4 additions & 7 deletions src/JsonPatch.Tests/AttributePathHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JsonPatch.Tests.Entities;
using JsonPatch.Formatting;
using JsonPatch.Paths.Components;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Paths.Components;
using JsonPatch.Tests.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace JsonPatch.Tests
{
[TestClass]
public class AttributePathHelperTests
{

private IPathResolver resolver = new AttributePropertyPathResolver(new JsonValueConverter());
private readonly IPathResolver resolver = new AttributePropertyPathResolver(new JsonValueConverter());

[TestMethod]
public void ParsePath_DataMember_ParsesSuccessfully()
Expand Down
10 changes: 4 additions & 6 deletions src/JsonPatch.Tests/CaseInsensitivePathHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JsonPatch.Tests.Entities;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Paths;
using JsonPatch.Paths.Components;
using JsonPatch;
using JsonPatch.Paths;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Tests.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Text.Json;

Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch.Tests/Entitys/ArrayEntity.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Tests.Entities
namespace JsonPatch.Tests.Entities
{
public class ArrayEntity
{
Expand Down
10 changes: 5 additions & 5 deletions src/JsonPatch.Tests/Entitys/ComplexEntity.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace JsonPatch.Tests.Entities
{
public class ComplexEntity
{
public ArrayEntity Foo { get; set; }

public SimpleEntity Bar { get; set; }

public SimpleEntity[] Baz { get; set; }

public List<SimpleEntity> Qux { get; set; }

public List<ListEntity> Norf { get; set; }
}
}
6 changes: 1 addition & 5 deletions src/JsonPatch.Tests/Entitys/DictionaryEntity.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace JsonPatch.Tests.Entities
{
Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch.Tests/Entitys/EnumEntity.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Tests.Entities
namespace JsonPatch.Tests.Entities
{
public class EnumEntity
{
Expand Down
6 changes: 1 addition & 5 deletions src/JsonPatch.Tests/Entitys/ListEntity.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace JsonPatch.Tests.Entities
{
Expand Down
9 changes: 3 additions & 6 deletions src/JsonPatch.Tests/Entitys/SimpleEntity.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace JsonPatch.Tests.Entities
{
public class SimpleEntity
{
public string Foo { get; set; }

public int Bar { get; set; }

public string Baz { get; set; }

[DataMember(Name = "pId")]
Expand Down
11 changes: 4 additions & 7 deletions src/JsonPatch.Tests/FlexiblePathHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JsonPatch.Tests.Entities;
using JsonPatch.Formatting;
using JsonPatch.Paths.Components;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Paths.Components;
using JsonPatch.Tests.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace JsonPatch.Tests
{
[TestClass]
public class FlexiblePathHelperTests
{

private FlexiblePathResolver resolver = new FlexiblePathResolver(new JsonValueConverter());
private readonly FlexiblePathResolver resolver = new FlexiblePathResolver(new JsonValueConverter());

[TestMethod]
public void ParsePath_DataMember_ParsesSuccessfully()
Expand Down
10 changes: 3 additions & 7 deletions src/JsonPatch.Tests/JsonPatchDocumentTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using JsonPatch.Tests.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JsonPatch.Tests.Entities;
using JsonPatch;
using System.Runtime;
using System.Text.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;

namespace JsonPatch.Tests
{
Expand Down
11 changes: 4 additions & 7 deletions src/JsonPatch.Tests/PathHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JsonPatch.Paths;
using JsonPatch.Paths.Components;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Tests.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using JsonPatch.Paths.Resolvers;
using JsonPatch.Paths;
using JsonPatch;
using JsonPatch.Paths.Components;

namespace JsonPatch.Tests
{
[TestClass]
public class PathHelperTests
{

private readonly IPathResolver _resolver = new ExactCasePropertyPathResolver(new JsonValueConverter());

#region ParsePath
Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch/Formatting/JsonPatchFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using JsonPatch.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch.Formatting
{
public class JsonPatchFormatter : BufferedMediaTypeFormatter
{
internal static JsonPatchSettings Settings { get; private set; }
public JsonPatchFormatter() : this(JsonPatchSettings.DefaultPatchSettings())
{

{
}

public JsonPatchFormatter(JsonPatchSettings settings)
Expand Down Expand Up @@ -81,7 +76,6 @@ public override object ReadFromStream(Type type, System.IO.Stream readStream, Sy
}

return jsonPatchDocument;

}
}
}
Expand Down
8 changes: 1 addition & 7 deletions src/JsonPatch/IJsonPatchDocument.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonPatch
namespace JsonPatch
{
public interface IJsonPatchDocument
{
Expand Down
1 change: 0 additions & 1 deletion src/JsonPatch/JsonPatchDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace JsonPatch
{
public class JsonPatchDocument<TEntity> : IJsonPatchDocument where TEntity : class, new()
{

private IPathResolver Resolver
{
get
Expand Down
Loading

0 comments on commit 2493010

Please sign in to comment.