Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
49 changes: 43 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,54 @@ dotnet build examples/DynamoMapper.SimpleExample/DynamoMapper.SimpleExample.cspr
# Run all tests across all target frameworks (net8.0, net9.0, net10.0)
dotnet test

# Run tests for specific framework
# Run tests for a specific framework
# (recommended when working on a single test failure)
dotnet test --framework net8.0

# Run tests with verbose output
dotnet test --logger "console;verbosity=detailed"

# Run specific test (example)
dotnet test --filter "FullyQualifiedName~Simple_HelloWorld"

# Run tests in specific project
dotnet test test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj
# Run tests in a specific project (avoid running other test projects)
dotnet test --project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj

# Discover available tests (xUnit v3 + Microsoft.Testing.Platform)
# Copy the fully-qualified test name from this output.
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--list-tests \
--no-progress \
--no-ansi

# Run a single test method (exact fully-qualified name)
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-method "MyNamespace.MyTestClass.MyTestMethod" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi

# Common filter variants
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-class "MyNamespace.MyTestClass" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi

DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-namespace "MyNamespace.Tests" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi
```

### Taskfile Commands (if task is installed)
Expand Down
44 changes: 43 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,53 @@ dotnet build
# Run all tests across all target frameworks (net8.0, net9.0, net10.0)
dotnet test

# Run tests for specific framework
# Run tests for a specific framework
# (recommended when working on a single test failure)
dotnet test --framework net8.0

# Run tests with verbose output
dotnet test --logger "console;verbosity=detailed"

# --- xUnit v3 + Microsoft.Testing.Platform (lowest-noise filtered runs) ---

# List available tests (discovery)
# Copy the fully-qualified test name from this output.
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--list-tests \
--no-progress \
--no-ansi

# Run a single test method (exact fully-qualified name)
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-method "MyNamespace.MyTestClass.MyTestMethod" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi

# Variants: class / namespace
DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-class "MyNamespace.MyTestClass" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi

DOTNET_NOLOGO=1 dotnet test \
--project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj \
-f net10.0 \
-v q \
--filter-namespace "MyNamespace.Tests" \
--minimum-expected-tests 1 \
--no-progress \
--no-ansi
```

### Restore Dependencies
Expand Down
1 change: 1 addition & 0 deletions LayeredCraft.DynamoMapper.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
</Folder>
<Folder Name="/examples/">
<Project Path="examples/DynamoMapper.FieldLevelOverride/DynamoMapper.FieldLevelOverride.csproj" />
<Project Path="examples/DynamoMapper.MapperConstructor/DynamoMapper.MapperConstructor.csproj" />
<Project Path="examples/DynamoMapper.SimpleExample/DynamoMapper.SimpleExample.csproj" />
</Folder>
<Folder Name="/git/">
Expand Down
28 changes: 28 additions & 0 deletions examples/DynamoMapper.MapperConstructor/ClassWithConstructor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;

namespace DynamoMapper.MapperConstructor;

[DynamoMapper]
public static partial class PersonClassMapper
{
public static partial Dictionary<string, AttributeValue> ToItem(PersonClass personClass);

public static partial PersonClass FromItem(Dictionary<string, AttributeValue> item);
}

public class PersonClass
{
[DynamoMapperConstructor]
public PersonClass(string firstName, string lastName, int age)
{
FirstName = firstName;
LastName = lastName;
Age = age;
}

public string FirstName { get; }
public string LastName { get; }
public int Age { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ο»Ώ<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.DynamoDBv2" />
</ItemGroup>
<ItemGroup>
<ProjectReference
Include="..\..\src\LayeredCraft.DynamoMapper.Generators\LayeredCraft.DynamoMapper.Generators.csproj"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer"
/>
<ProjectReference
Include="..\..\src\LayeredCraft.DynamoMapper.Runtime\LayeredCraft.DynamoMapper.Runtime.csproj"
ReferenceOutputAssembly="true"
OutputItemType="Analyzer"
/>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions examples/DynamoMapper.MapperConstructor/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ο»Ώ// See https://aka.ms/new-console-template for more information

using System;

Console.WriteLine("Hello, World!");
25 changes: 25 additions & 0 deletions examples/DynamoMapper.MapperConstructor/RecordMapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using DynamoMapper.Runtime;

namespace DynamoMapper.MapperConstructor;

[DynamoMapper]
public static partial class PersonRecordMapper
{
public static partial Dictionary<string, AttributeValue> ToItem(PersonRecord personRecord);

public static partial PersonRecord FromItem(Dictionary<string, AttributeValue> item);

// public static void Do()
// {
// var person = new PersonRecord
// {
// FirstName = "John",
// LastName = "Doe",
// Age = 30,
// };
// }
}

public record PersonRecord(string FirstName, string LastName, int Age);
9 changes: 9 additions & 0 deletions global.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Why did you add this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed to make MTP tests work when run through the CLI. I added this along with the agent commands so that coding agents could better run tests without burning tokens.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This how you made it work with dotnet test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"rollForward": "latestMinor",
"version": "10.0.101"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
Rule ID | Category | Severity | Notes
---------|--------------------|----------|-----------------------
DM0001 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0003 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0004 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0005 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0101 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0102 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0102 | DynamoMapper.Usage | Error | DiagnosticDescriptors
DM0103 | DynamoMapper.Usage | Error | DiagnosticDescriptors
Loading