Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release candidate code #4

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
21cf2d0
Fix benchmarks
dev-experience Jul 16, 2021
f3123fa
Minor refactoring in `Xtz.StronglyTyped.BogusAutoFixture.UnitTests`
dev-experience Jul 16, 2021
6ed6685
Fix `ShouldThrowIfEmpty()` in `StronglyTyped<>` class form `decimal i…
dev-experience Jul 16, 2021
512a398
Consolidate NuGet package versions
dev-experience Jul 16, 2021
417464c
Update `Xtz.StronglyTyped.BuiltinTypes.AutoFixture`
dev-experience Jul 16, 2021
359d00e
Update `StronglyTypedGenerator`
dev-experience Jul 16, 2021
6c806cf
Add more tests to `Xtz.StronglyTyped.SourceGenerator.IntegrationTests`
dev-experience Jul 16, 2021
559cb97
Implement strongly-typed JSON converter for NewtonsoftJson
dev-experience Jul 16, 2021
47fc2f3
Fix `Xtz.StronglyTyped.Api_3_1.IntegrationTests`
dev-experience Jul 16, 2021
912dc63
Remove redundant test models
dev-experience Jul 16, 2021
9df75fe
Update `Xtz.StronglyTyped.UnitTests`
dev-experience Jul 16, 2021
dc131f5
Add `Xtz.StronglyTyped.NewtonsoftJson.UnitTests`
dev-experience Jul 16, 2021
25deb9e
Bump up the versions
dev-experience Jul 16, 2021
ad811ff
Merge branch 'main' into feature/release-candidate
dev-experience Jul 16, 2021
087a66e
Upgrade NuGet dependencies and fix `nullable` warnings
dev-experience Jul 16, 2021
988d42e
Fix tests for non-string values
dev-experience Jul 16, 2021
183caf2
Fix JSON converters
dev-experience Jul 16, 2021
943342b
Bump up the versions
dev-experience Jul 16, 2021
50d05fa
Remove redundant NuGet references
dev-experience Jul 17, 2021
fd401c6
Revert NuGet upgrades as they break `Xtz.StronglyTyped.SourceGenerator`
dev-experience Jul 17, 2021
d9325cc
Improve code coverage results by marking generated code with attribut…
dev-experience Jul 17, 2021
2fc2e28
Bump up the versions
dev-experience Jul 17, 2021
2d44407
Eliminate compiler and analyzer warnings by applying suggested action…
dev-experience Jul 17, 2021
d2f4e3f
Fix assembly conflict warnings
dev-experience Jul 17, 2021
bac5674
Minor project files cleanup
dev-experience Jul 17, 2021
f2c99f4
Refactor generator
dev-experience Jul 17, 2021
d18e072
Refactor JSON converters
dev-experience Jul 17, 2021
2581ac8
Add `[DebuggerDisplay]` and `.ToString()` to records in `Xtz.Strongly…
dev-experience Jul 17, 2021
02c52be
Resovle some `// TODO:`
dev-experience Jul 17, 2021
73a6c8b
Fix a bug of failing to analyze incomplete code
dev-experience Jul 17, 2021
a35e9a6
Minor refactoring
dev-experience Jul 17, 2021
493a05e
Remove `IConvertible` tests
dev-experience Jul 17, 2021
5f0894c
Minor refactoring
dev-experience Jul 17, 2021
a9aa9a9
Bump up versions
dev-experience Jul 17, 2021
549a160
Add `NUnit.Analyzers` and apply suggestions
dev-experience Jul 17, 2021
a108124
Add more static analyzers and fix/suppress warnings
dev-experience Jul 17, 2021
a9d43c2
Set analysis level for .NET analyzer
dev-experience Jul 17, 2021
ed7ed33
Apply code analysis suggestions or explicitly suppress them
dev-experience Jul 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more tests to Xtz.StronglyTyped.SourceGenerator.IntegrationTests
- Add tests for structs with all supported inner types
dev-experience committed Jul 16, 2021
commit 6c806cf008a63cbbab6dc33f2a8d71af53e71b3c
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public class InnerTypesGeneratorTests : GeneratorTestsBase
[TestCase(typeof(uint))]
[TestCase(typeof(ulong))]
[TestCase(typeof(ushort))]
public void ShouldGenerate_ForPrimitiveTypes(Type innerType)
public void ShouldGenerateClass_ForPrimitiveTypes(Type innerType)
{
//// Arrange

@@ -63,7 +63,7 @@ public partial class WithInnerType
[TestCase(typeof(MailAddress))]
[TestCase(typeof(IPAddress))]
[TestCase(typeof(PhysicalAddress))]
public void ShouldGenerate_ForKnownTypes(Type innerType)
public void ShouldGenerateClass_ForKnownTypes(Type innerType)
{
//// Arrange

@@ -92,5 +92,88 @@ public partial class WithInnerType

AssertGenerationSuccess(4, diagnostics, outputCompilation, driver.GetRunResult());
}

[Test]
[TestCase(typeof(bool))]
[TestCase(typeof(byte))]
[TestCase(typeof(char))]
[TestCase(typeof(decimal))]
[TestCase(typeof(double))]
[TestCase(typeof(float))]
[TestCase(typeof(int))]
[TestCase(typeof(long))]
[TestCase(typeof(sbyte))]
[TestCase(typeof(short))]
[TestCase(typeof(string))]
[TestCase(typeof(uint))]
[TestCase(typeof(ulong))]
[TestCase(typeof(ushort))]
public void ShouldGenerateStruct_ForPrimitiveTypes(Type innerType)
{
//// Arrange

var sourceCode = $@"
namespace IntegrationTests.Generated
{{
using Xtz.StronglyTyped.SourceGenerator;

[StrongType(typeof({innerType.FullName}))]
public partial struct WithInnerType
{{
}}
}}
";

var inputCompilation = CreateCompilation(sourceCode, OutputKind.DynamicallyLinkedLibrary);

//// Act

GeneratorDriver driver = CSharpGeneratorDriver.Create(new StronglyTypedGenerator());

// NOTE: the generator driver itself is immutable, and all calls return an updated version of the driver that you should use for subsequent calls
driver = driver.RunGeneratorsAndUpdateCompilation(inputCompilation, out var outputCompilation, out var diagnostics);

//// Assert

AssertGenerationSuccess(4, diagnostics, outputCompilation, driver.GetRunResult());
}

[Test]
[TestCase(typeof(DateTime))]
[TestCase(typeof(TimeSpan))]
[TestCase(typeof(Guid))]
[TestCase(typeof(Uri))]
[TestCase(typeof(MailAddress))]
[TestCase(typeof(IPAddress))]
[TestCase(typeof(PhysicalAddress))]
public void ShouldGenerateStruct_ForKnownTypes(Type innerType)
{
//// Arrange

var sourceCode = $@"
namespace IntegrationTests.Generated
{{
using Xtz.StronglyTyped.SourceGenerator;

[StrongType(typeof({innerType.FullName}))]
public partial struct WithInnerType
{{
}}
}}
";

var inputCompilation = CreateCompilation(sourceCode, OutputKind.DynamicallyLinkedLibrary);

//// Act

GeneratorDriver driver = CSharpGeneratorDriver.Create(new StronglyTypedGenerator());

// NOTE: the generator driver itself is immutable, and all calls return an updated version of the driver that you should use for subsequent calls
driver = driver.RunGeneratorsAndUpdateCompilation(inputCompilation, out var outputCompilation, out var diagnostics);

//// Assert

AssertGenerationSuccess(4, diagnostics, outputCompilation, driver.GetRunResult());
}
}
}