Skip to content

Commit

Permalink
fix(dotnet-sdk): fix variable values and types in variable mapping cl…
Browse files Browse the repository at this point in the history
…ass (#1161)

Fix LH variable values mapping, variable output validations and add unit tests
  • Loading branch information
KarlaCarvajal authored Nov 25, 2024
1 parent b557bf3 commit 2f6606b
Show file tree
Hide file tree
Showing 8 changed files with 360 additions and 50 deletions.
40 changes: 0 additions & 40 deletions sdk-dotnet/LittleHorse.Sdk.Tests/LHLoggerFactoryProviderTest.cs

This file was deleted.

6 changes: 6 additions & 0 deletions sdk-dotnet/LittleHorse.Sdk.Tests/LHTaskSignatureTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using LittleHorse.Common.Proto;
using LittleHorse.Sdk;
using LittleHorse.Sdk.Exceptions;
using LittleHorse.Sdk.Worker;
using LittleHorse.Sdk.Worker.Internal;
Expand All @@ -20,6 +21,11 @@ public class LHTaskSignatureTest
const string DETAIL_ATTR_NAME = "detail";
const string TELEPHONE_ATTR_NAME = "telephone";

public LHTaskSignatureTest()
{
LHLoggerFactoryProvider.Initialize(null);
}

[Fact]
public void TaskSignature_WithLHTaskMethodAndLHTypeAttributes_ShouldBuildLHSignatureWithInputAndOutput()
{
Expand Down
4 changes: 2 additions & 2 deletions sdk-dotnet/LittleHorse.Sdk.Tests/TestClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Car

public class Person
{
public string FirstName { get; set; }
public string? FirstName { get; set; }
public int Age { get; set; }
public List<Car> Cars { get; set; }
public List<Car>? Cars { get; set; }
}
4 changes: 2 additions & 2 deletions sdk-dotnet/LittleHorse.Sdk.Tests/Utils/JsonHandlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public void JsonHandler_WithJsonString_ShouldReturnCustomObject()

var result = JsonHandler.DeserializeFromJson(jsonString, typeof(Person));

var actual = (Person) result;
var actual = (Person) result!;

Assert.Equal("Test", actual.FirstName);
Assert.Equal(35, actual.Age);
Assert.Equal(1, actual.Cars[0].Id);
Assert.Equal(1, actual.Cars![0].Id);
Assert.Equal(134.45E-2f, actual.Cars[0].Cost);
}
}
Expand Down
Loading

0 comments on commit 2f6606b

Please sign in to comment.