File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
libraries/tests/AWS.Lambda.Powertools.Metrics.Tests Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ using AWS . Lambda . Powertools . Common ;
2+ using Moq ;
3+ using Xunit ;
4+
5+ namespace AWS . Lambda . Powertools . Metrics . Tests ;
6+
7+ [ Collection ( "Sequential" ) ]
8+ public class MetricsTests
9+ {
10+ [ Fact ]
11+ public void Metrics_Set_Execution_Environment_Context ( )
12+ {
13+ // Arrange
14+ var assemblyName = "AWS.Lambda.Powertools.Metrics" ;
15+ var assemblyVersion = "1.0.0" ;
16+
17+ var env = new Mock < IPowertoolsEnvironment > ( ) ;
18+ env . Setup ( x => x . GetAssemblyName ( It . IsAny < Metrics > ( ) ) ) . Returns ( assemblyName ) ;
19+ env . Setup ( x => x . GetAssemblyVersion ( It . IsAny < Metrics > ( ) ) ) . Returns ( assemblyVersion ) ;
20+
21+ var conf = new PowertoolsConfigurations ( new SystemWrapper ( env . Object ) ) ;
22+
23+ var metrics = new Metrics ( conf ) ;
24+
25+ // Assert
26+ env . Verify ( v =>
27+ v . SetEnvironmentVariable (
28+ "AWS_EXECUTION_ENV" , $ "PTFeature/Metrics/{ assemblyVersion } "
29+ ) , Times . Once ) ;
30+
31+ env . Verify ( v =>
32+ v . GetEnvironmentVariable (
33+ "AWS_EXECUTION_ENV"
34+ ) , Times . Once ) ;
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments