Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
EngRajabi committed May 31, 2022
1 parent cf78081 commit 969c951
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.12
Breaking changes
- rename StringToFast to ToStringFast
## 1.0.11
- Add method GetValuesFast
- Add method GetNamesFast
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For example:
```csharp
public static class UserTypeTestEnumExtensions
{
public static string StringToFast(this UnitTests.UserTypeTest states)
public static string ToStringFast(this UnitTests.UserTypeTest states)
{
return states switch
{
Expand Down Expand Up @@ -110,7 +110,7 @@ You do not see this file inside the project. But you can use it.

Usage
```csharp
var stringEnum = UserTypeTest.Men.StringToFast(); //Men;
var stringEnum = UserTypeTest.Men.ToStringFast(); //Men;
var isDefined = UserTypeTestEnumExtensions.IsDefinedFast(UserType.Men); //true;
Expand Down
2 changes: 1 addition & 1 deletion Supernova.Enum.Generators/SourceGeneratorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class SourceGeneratorHelper

public const string NameSpace = "EnumFastToStringGenerated";
public const string AttributeName = "EnumGenerator";
public const string ExtensionMethodNameToString = "StringToFast";
public const string ExtensionMethodNameToString = "ToStringFast";
public const string ExtensionMethodNameIsDefined = "IsDefinedFast";
public const string ExtensionMethodNameToDisplay = "ToDisplayFast";
public const string ExtensionMethodNameGetValues = "GetValuesFast";
Expand Down
15 changes: 8 additions & 7 deletions Supernova.Enum.Generators/Supernova.Enum.Generators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
<PackageId>Supernova.Enum.Generators</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Version>1.0.11</Version>
<PackageVersion>1.0.11</PackageVersion>
<AssemblyVersion>1.0.11</AssemblyVersion>
<Version>1.0.12</Version>
<PackageVersion>1.0.12</PackageVersion>
<AssemblyVersion>1.0.12</AssemblyVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReleaseNotes>v1.0.11
- Add method GetValuesFast
- Add method GetNamesFast
- Add method GetLengthFast</PackageReleaseNotes>
<PackageReleaseNotes>
v1.0.12
Breaking changes
- rename StringToFast to ToStringFast
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions test/Console.Test.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Analysers;
using BenchmarkDotNet.Analysers;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
Expand All @@ -15,6 +10,11 @@
using BenchmarkDotNet.Running;
using EnumFastToStringGenerated;
using Perfolizer.Horology;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;

namespace Console.Test.Benchmark;

Expand Down Expand Up @@ -70,7 +70,7 @@ public string NativeToString()
public string FasterToString()
{
var state = UserType.Men;
return state.StringToFast();
return state.ToStringFast();
}

[Benchmark]
Expand Down
11 changes: 6 additions & 5 deletions test/UnitTests/EnumGeneratorTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.ComponentModel.DataAnnotations;
using EnumFastToStringGenerated;
using EnumFastToStringGenerated;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.ComponentModel.DataAnnotations;

namespace UnitTests;

Expand Down Expand Up @@ -30,7 +31,7 @@ public void TestEnumDefined()
[TestMethod]
public void TestEnumToString()
{
var menString = UserTypeTest.Men.StringToFast();
var menString = UserTypeTest.Men.ToStringFast();

Assert.AreEqual("Men", menString);
}
Expand Down Expand Up @@ -79,7 +80,7 @@ public void TestEnumGetValues()
public void TestEnumGetLength()
{
var length = UserTypeTestEnumExtensions.GetLengthFast();
Assert.AreEqual(3, length);

Assert.AreEqual(Enum.GetValues<UserTypeTest>().Length, length);
}
}

0 comments on commit 969c951

Please sign in to comment.