コード例 #1
0
 public void CreateOnContainerReturnsCorrectResult()
 {
     // Fixture setup
     object expectedResult = 1;
     var container = new DelegatingSpecimenContext { OnResolve = r => r.Equals(new SeededRequest(typeof(int), 0)) ? expectedResult : new NoSpecimen(r) };
     // Exercise system
     var result = container.Create<int>();
     // Verify outcome
     Assert.Equal(expectedResult, result);
     // Teardown
 }
コード例 #2
0
 public void CreateSeededOnContainerReturnsCorrectResult()
 {
     // Fixture setup
     var seed = TimeSpan.FromMinutes(8);
     object expectedResult = TimeSpan.FromHours(2);
     var container = new DelegatingSpecimenContext { OnResolve = r => r.Equals(new SeededRequest(typeof(TimeSpan), seed)) ? expectedResult : new NoSpecimen(r) };
     // Exercise system
     var result = container.Create(seed);
     // Verify outcome
     Assert.Equal(expectedResult, result);
     // Teardown
 }