Skip to content

Commit

Permalink
reverted nuget.config changes, fix linting spacing issue caused by fo…
Browse files Browse the repository at this point in the history
…rmatter

Signed-off-by: Andrei de la Cruz <andrei.delacruz@gmail.com>
  • Loading branch information
jeandreidc committed Oct 4, 2024
1 parent 6633132 commit d8c4e85
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 41 deletions.
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="github-open-feature" value="https://nuget.pkg.github.com/open-feature/index.json" allowInsecureConnections="True" />
<add key="github-open-feature" value="https://nuget.pkg.github.com/open-feature/index.json"/>
</packageSources>

<packageSourceMapping>
Expand Down
71 changes: 34 additions & 37 deletions test/OpenFeature.Contrib.Providers.Flipt.Test/FlipExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,37 +100,34 @@ public void ToStringDictionary_WithContextAndMixedValueTypes_ShouldReturnADictio
[Fact]
public void ToStringDictionary_WithContextWithListAndNestedList_ShouldReturnADictionaryWithSerializedValues()
{
var testStructure = new Structure(new Dictionary<string, Value>
{
{
"config2",
new Value([
new Value([new Value("element1-1"), new Value("element1-2")]), new Value("element2"),
new Value("element3")
])
},
{ "config3", new Value(DateTime.Now) }
});
var sampleDictionary = new Dictionary<string, Value>();
sampleDictionary["config2"] = new Value([
new Value([new Value("element1-1"), new Value("element1-2")]), new Value("element2"),
new Value("element3")
]);
sampleDictionary["config3"] = new Value(DateTime.Now);

var testStructure = new Structure(sampleDictionary);

var evaluationContext = EvaluationContext.Builder()
.SetTargetingKey(Guid.NewGuid().ToString())
.Set("config", testStructure)
.Build();
var result = evaluationContext.ToStringDictionary();
var evaluationContext = EvaluationContext.Builder()
.SetTargetingKey(Guid.NewGuid().ToString())
.Set("config", testStructure)
.Build();
var result = evaluationContext.ToStringDictionary();

result.Should().NotBeNull();
result.Should().NotBeEmpty();
result.Keys.Should().Contain("config");
result.Should().NotBeNull();
result.Should().NotBeEmpty();
result.Keys.Should().Contain("config");

var deserialized = JsonSerializer.Deserialize<Structure>(result["config"],
JsonConverterExtensions.DefaultSerializerSettings);
deserialized.Should().BeEquivalentTo(testStructure);
var deserialized = JsonSerializer.Deserialize<Structure>(result["config"],
JsonConverterExtensions.DefaultSerializerSettings);
deserialized.Should().BeEquivalentTo(testStructure);
}

[Fact]
public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues()
{
var testStructure = new Structure(new Dictionary<string, Value>
public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADictionaryWithSerializedValues()
{
var testStructure = new Structure(new Dictionary<string, Value>
{
{
"config-value-struct", new Value(new Structure(new Dictionary<string, Value>
Expand All @@ -141,18 +138,18 @@ public void ToStringDictionary_WithContextWithNestedStructure_ShouldReturnADicti
{ "config-value-value", new Value(new Value(DateTime.Now)) }
});

var evaluationContext = EvaluationContext.Builder()
.SetTargetingKey(Guid.NewGuid().ToString())
.Set("config", testStructure)
.Build();
var result = evaluationContext.ToStringDictionary();
var evaluationContext = EvaluationContext.Builder()
.SetTargetingKey(Guid.NewGuid().ToString())
.Set("config", testStructure)
.Build();
var result = evaluationContext.ToStringDictionary();

result.Should().NotBeNull();
result.Should().NotBeEmpty();
result.Keys.Should().Contain("config");
result.Should().NotBeNull();
result.Should().NotBeEmpty();
result.Keys.Should().Contain("config");

var deserialized = JsonSerializer.Deserialize<Structure>(result["config"],
JsonConverterExtensions.DefaultSerializerSettings);
deserialized.Should().BeEquivalentTo(testStructure);
}
var deserialized = JsonSerializer.Deserialize<Structure>(result["config"],
JsonConverterExtensions.DefaultSerializerSettings);
deserialized.Should().BeEquivalentTo(testStructure);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void CreateFliptProvider_ShouldReturnFliptProvider()
[Fact]
public void CreateFliptProvider_GivenEmptyUrl_ShouldThrowInvalidOperationException()
{
var act = void () => new FliptProvider("");
var act = void() => new FliptProvider("");
act.Should().Throw<UriFormatException>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ public async Task EvaluateAsync_GivenExistingVariantFlagAndWithAnObject_ShouldRe
const string variantKey = "variant-A";
const string valueFromSrc = """
{
"name": "Mr. Robinson",
"name": "Mr. Robinson",
"age": 12,
}
""";
""";
var expectedValue = new Value(new Structure(new Dictionary<string, Value>
{
{ "name", new Value("Mr. Robinson") }, { "age", new Value(12) }
Expand Down

0 comments on commit d8c4e85

Please sign in to comment.