public void ReturnDevelopmentValue() { using (new DeploymentContextInjectionScope(targetEnvironment: TargetEnvironment.DEVELOPMENT)) { DateSetting.Should().Be(new(2021, 3, 3)); Setting1.Should().Be("one.1"); Setting2.Should().Be(3); Setting3.Should().Be("three.1"); Invoking(() => Setting4) .Should().Throw <NotSupportedException>() .WithMessage($"'{nameof(Setting4)}' does not provide a value for target environment '{TargetEnvironment.DEVELOPMENT}'."); Invoking(() => Setting5).Should().NotThrow().And.Subject().Should().Be(0); Setting6.Should().Be(1); Setting7.Should().Be(1); } }
public void ReturnAcceptanceValue() { using (new DeploymentContextInjectionScope(targetEnvironment: TargetEnvironment.ACCEPTANCE)) { DateSetting.Should().Be(DateTime.MinValue); Setting1.Should().Be("one.2"); Setting2.Should().Be(1); Setting3.Should().Be("three.2"); Invoking(() => Setting4).Should().NotThrow().And.Subject().Should().Be("four"); Invoking(() => Setting5) .Should().Throw <NotSupportedException>() .WithMessage($"'{nameof(Setting5)}' does not provide a value for target environment '{TargetEnvironment.ACCEPTANCE}'."); Setting6.Should().Be(3); Setting7.Should().Be(4); } }
public void ReturnBuildValue() { using (new DeploymentContextInjectionScope(targetEnvironment: TargetEnvironment.BUILD)) { Invoking(() => DateSetting) .Should().Throw <NotSupportedException>() .WithMessage($"'{nameof(DateSetting)}' does not provide a value for target environment '{TargetEnvironment.BUILD}'."); Setting1.Should().Be("one.1"); Setting2.Should().Be(2); Setting3.Should().Be("three.1"); Invoking(() => Setting4) .Should().Throw <NotSupportedException>() .WithMessage($"'{nameof(Setting4)}' does not provide a value for target environment '{TargetEnvironment.BUILD}'."); Invoking(() => Setting5).Should().NotThrow().And.Subject().Should().Be(0); Setting6.Should().Be(2); Setting7.Should().Be(2); } }