Skip to content

Commit

Permalink
refactor: update namespace (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisdg authored Feb 11, 2022
1 parent 694786e commit 20b0bf2
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: Dedge.Cardidy
PROJECT_NAME: DEdge.Cardidy
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/d-edge/
GITHUB_USER: aloisdg
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In a library like Cardidy, one of the main way to contribute is by adding a new
- Clone the project and checkout the `main` branch
- From `main` create a new branch named `feat/addXxx`
- Create a card for Xxx
- Open `src/Dedge.Cardidy/Model/Cards.cs`
- Open `src/DEdge.Cardidy/Model/Cards.cs`
- Add a new record for you card

```csharp
Expand Down Expand Up @@ -82,7 +82,7 @@ internal record Verve : ACard

```

- Then, open `src/Dedge.Cardidy/Cardidy.cs`
- Then, open `src/DEdge.Cardidy/Cardidy.cs`
- And add the new card to the array `knownCards`

- Test your code
Expand Down
2 changes: 1 addition & 1 deletion Cardidy.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31612.314
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cardidy", "src\Dedge.Cardidy\Dedge.Cardidy.csproj", "{826BA1C0-41F1-4183-A7E7-67DF7FC9A843}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cardidy", "src\DEdge.Cardidy\DEdge.Cardidy.csproj", "{826BA1C0-41F1-4183-A7E7-67DF7FC9A843}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "src\Tests\Tests.csproj", "{855909CC-D532-43F5-8457-969C38F578E4}"
EndProject
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<p align="center">
<a href="https://github.com/d-edge/Cardidy/actions" title="actions"><img src="https://github.com/d-edge/cardidy/actions/workflows/build.yml/badge.svg?branch=main" alt="actions build" /></a>
<a href="https://www.nuget.org/packages/Dedge.Cardidy/" title="nuget"><img src="https://img.shields.io/nuget/vpre/Dedge.Cardidy" alt="version" /></a>
<!--<a href="https://www.nuget.org/stats/packages/Dedge.Cardidy?groupby=Version" title="stats"><img src="https://img.shields.io/nuget/dt/Dedge.Cardidy" alt="download" /></a>-->
<a href="https://www.nuget.org/packages/DEdge.Cardidy/" title="nuget"><img src="https://img.shields.io/nuget/vpre/DEdge.Cardidy" alt="version" /></a>
<!--<a href="https://www.nuget.org/stats/packages/DEdge.Cardidy?groupby=Version" title="stats"><img src="https://img.shields.io/nuget/dt/DEdge.Cardidy" alt="download" /></a>-->
<a href="https://raw.githubusercontent.com/d-edge/cardidy/main/LICENSE" title="license"><img src="https://img.shields.io/github/license/d-edge/Cardidy" alt="license" /></a>
</p>

Expand All @@ -34,18 +34,18 @@ Cardidy is a .net library to identify credit card number and cvv. Maintained by

## Getting Started

Install the [Dedge.Cardidy](https://www.nuget.org/packages/Dedge.Cardidy) NuGet package:
Install the [DEdge.Cardidy](https://www.nuget.org/packages/DEdge.Cardidy) NuGet package:

PM> Install-Package Dedge.Cardidy
PM> Install-Package DEdge.Cardidy

Alternatively you can also use the .NET CLI to add the packages:

dotnet add package Dedge.Cardidy
dotnet add package DEdge.Cardidy

Next create a .net application and use Dedge.Cardidy:
Next create a .net application and use DEdge.Cardidy:

```csharp
var card = Dedge.Cardidy.Identify("4127540509730813").Single();
var card = DEdge.Cardidy.Identify("4127540509730813").Single();
Console.WriteLine(card); // print Visa
```

Expand All @@ -56,7 +56,7 @@ open System
[<EntryPoint>]
let main _ =
let isVisa = Dedge.Cardidy.Identify "4127540509730813" |> Seq.head = Dedge.CardType.Visa
let isVisa = DEdge.Cardidy.Identify "4127540509730813" |> Seq.head = DEdge.CardType.Visa
printfn "%b" isVisa
0
```
Expand Down
8 changes: 4 additions & 4 deletions src/App/App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="Dedge.Cardidy" Version="0.1.0-beta" />
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="DEdge.Cardidy" Version="0.1.0-beta" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dedge.Cardidy\Dedge.Cardidy.csproj" />
<ProjectReference Include="..\DEdge.Cardidy\DEdge.Cardidy.csproj" />
<ProjectReference Include="..\Tests\Tests.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/App/BenchmarkCardidy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BenchmarkDotNet.Attributes;
using Dedge;
using DEdge;

namespace App
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using App;
using BenchmarkDotNet.Running;
using Dedge;
using DEdge;

Console.WriteLine(Cardidy.Identify("4127540509730813").Single());
var summary = BenchmarkRunner.Run<BenchmarkCardidy>();
Expand Down
2 changes: 1 addition & 1 deletion src/AppFs/AppFs.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dedge.Cardidy\Dedge.Cardidy.csproj" />
<ProjectReference Include="..\DEdge.Cardidy\DEdge.Cardidy.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/AppFs/Program.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[<EntryPoint>]
let main _ =
let card = "4127540509730813"
let isVisa = Dedge.Cardidy.Identify card |> Seq.head = Dedge.CardType.Visa
let isVisa = DEdge.Cardidy.Identify card |> Seq.head = DEdge.CardType.Visa
printfn "Is %s a visa: %b" card isVisa
0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Dedge;
namespace DEdge;

/// <summary>
/// Current supported CardType
Expand Down
4 changes: 2 additions & 2 deletions src/Dedge.Cardidy/Cardidy.cs → src/DEdge.Cardidy/Cardidy.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Dedge.Model;
using DEdge.Model;
using System.Collections.Generic;
using System.Linq;

namespace Dedge;
namespace DEdge;

/// <summary>
/// Validate or identify card number and cvv with Cardidy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- General -->
<AssemblyName>Dedge.Cardidy</AssemblyName>
<AssemblyName>DEdge.Cardidy</AssemblyName>
<Description>A .net library to identify card number and cvv</Description>
<Copyright>Copyright 2021 D-EDGE</Copyright>
<Authors>D-EDGE and contributors</Authors>
Expand All @@ -19,8 +19,8 @@
<IncludeSymbols>true</IncludeSymbols>

<!-- NuGet settings -->
<PackageId>Dedge.Cardidy</PackageId>
<PackageTags>Dedge;Cardidy;Credit;Payment;Card;Number;Visa;Cvv;Identify;Validate;Detection;</PackageTags>
<PackageId>DEdge.Cardidy</PackageId>
<PackageTags>DEdge;Cardidy;Credit;Payment;Card;Number;Visa;Cvv;Identify;Validate;Detection;</PackageTags>
<PackageReleaseNotes>https://raw.githubusercontent.com/d-edge/cardidy/main/RELEASE_NOTES.md</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/d-edge/cardidy</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Dedge;
namespace DEdge;

internal static class Extensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Dedge.Model;
namespace DEdge.Model;

internal abstract record ACard : ICard
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Dedge.Model;
namespace DEdge.Model;

internal abstract record ALuhnCard : ACard
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Dedge.Model;
namespace DEdge.Model;

// OOP-afficionados, is this worthwile?
internal abstract record ASixteenCard : ACard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Dedge.Model;
namespace DEdge.Model;

// Based on https://en.wikipedia.org/wiki/Payment_card_number
internal record AmericanExpress : ALuhnCard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Dedge.Model;
namespace DEdge.Model;

internal interface ICard
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Dedge.Model;
namespace DEdge.Model;

internal record PaddedRange
{
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion src/Tests/CvvTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dedge;
using DEdge;
using NUnit.Framework;

namespace Tests;
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/IdentifyTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dedge;
using DEdge;
using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/OptionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dedge;
using DEdge;
using NUnit.Framework;
using System.Collections.Generic;

Expand Down
20 changes: 11 additions & 9 deletions src/Tests/RandomizedTests.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
using Dedge;
using DEdge;
using NUnit.Framework;
using System.Linq;

namespace Tests;
public class RandomizedTests
{
private readonly Cardizer _cardizer = new Cardizer();

[Test(ExpectedResult = CardType.AmericanExpress)]
public CardType ShouldIdentifyRandomAmex() => Cardidy.Identify(Cardizer.NextAmex()).First();
public CardType ShouldIdentifyRandomAmex() => Cardidy.Identify(_cardizer.NextAmex()).First();

[Test(ExpectedResult = CardType.Discover)]
public CardType ShouldIdentifyRandomDiscover() => Cardidy.Identify(Cardizer.NextDiscover()).First();
public CardType ShouldIdentifyRandomDiscover() => Cardidy.Identify(_cardizer.NextDiscover()).First();

[Test(ExpectedResult = CardType.Jcb)]
public CardType ShouldIdentifyRandomJcb() => Cardidy.Identify(Cardizer.NextJcb()).First();
public CardType ShouldIdentifyRandomJcb() => Cardidy.Identify(_cardizer.NextJcb()).First();

[Test(ExpectedResult = CardType.MasterCard)]
public CardType ShouldIdentifyRandomMasterCard() => Cardidy.Identify(Cardizer.NextMasterCard()).First();
public CardType ShouldIdentifyRandomMasterCard() => Cardidy.Identify(_cardizer.NextMasterCard()).First();

[Test(ExpectedResult = CardType.Mir)]
public CardType ShouldIdentifyRandomMir() => Cardidy.Identify(Cardizer.NextMir()).First();
public CardType ShouldIdentifyRandomMir() => Cardidy.Identify(_cardizer.NextMir()).First();

[Test(ExpectedResult = CardType.Uatp)]
public CardType ShouldIdentifyRandomUatp() => Cardidy.Identify(Cardizer.NextUatp()).First();
public CardType ShouldIdentifyRandomUatp() => Cardidy.Identify(_cardizer.NextUatp()).First();

[Test(ExpectedResult = CardType.Verve)]
public CardType ShouldIdentifyRandomVerve() => Cardidy.Identify(Cardizer.NextVerve()).First();
public CardType ShouldIdentifyRandomVerve() => Cardidy.Identify(_cardizer.NextVerve()).First();

[Test(ExpectedResult = CardType.Visa)]
public CardType ShouldIdentifyRandomVisa() => Cardidy.Identify(Cardizer.NextVisa()).First();
public CardType ShouldIdentifyRandomVisa() => Cardidy.Identify(_cardizer.NextVisa()).First();
}
4 changes: 2 additions & 2 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dedge.Cardizer" Version="0.5.0-alpha" />
<PackageReference Include="DEdge.Cardizer" Version="0.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="coverlet.collector" Version="3.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dedge.Cardidy\Dedge.Cardidy.csproj" />
<ProjectReference Include="..\DEdge.Cardidy\DEdge.Cardidy.csproj" />
</ItemGroup>

</Project>

0 comments on commit 20b0bf2

Please sign in to comment.