Skip to content

Commit

Permalink
Demo additionalConfiguration usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
chullybun committed Oct 10, 2024
1 parent 21df65e commit c302260
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/UnitTestEx.NUnit.Test/ServiceBusFunctionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text.Json;
Expand Down Expand Up @@ -141,5 +142,14 @@ public void Configuration()
var cv = test.Configuration.GetValue<string>("SpecialKey");
Assert.That(cv, Is.EqualTo("VerySpecialValue"));
}

[Test]
public void Configuration_Overrride()
{
// Demonstrates how to override the configuration settings for a test.
using var test = FunctionTester.Create<Startup>(additionalConfiguration: new Dictionary<string, string>(new KeyValuePair<string, string>[] { new("SpecialKey", "NotSoSpecial") }));
var cv = test.Configuration.GetValue<string>("SpecialKey");
Assert.That(cv, Is.EqualTo("NotSoSpecial"));
}
}
}

0 comments on commit c302260

Please sign in to comment.