internal void CreateStaticMethodInvocationData( SpecimenProvider specimenProvider, RegexFilter filter) { // Arrange filter.IncludeMethod("Compare", typeof (Uri)) .Rules.Add(new RegexRule("exclude all", type: new Regex(".*"), method: new Regex(".*"))); IArgumentNullExceptionFixture sut = new ArgumentNullExceptionFixture(typeof(Uri).Assembly, specimenProvider, new List<IFilter> { filter }, new List<IMapping>()); // Act List<MethodData> methodDatas = sut.GetData().ToList(); // Assert Assert.Equal(5, methodDatas.Count); Assert.Equal(5, methodDatas.Select(m => m.ExecutionSetup).OfType<DefaultExecutionSetup>().Count()); }
public void CreateErroredMethodInvocationData( Mock<ISpecimenProvider> specimenProviderMock, FileNotFoundException exception, RegexFilter filter) { // Arrange specimenProviderMock.Setup(sp => sp.GetParameterSpecimens(It.IsAny<IList<ParameterInfo>>(), It.IsAny<int>())) .Throws(exception); filter.IncludeMethod("Compare", typeof(Uri)) .Rules.Add(new RegexRule("exclude all", type: new Regex(".*"), method: new Regex(".*"))); IArgumentNullExceptionFixture sut = new ArgumentNullExceptionFixture(typeof(Uri).Assembly, specimenProviderMock.Object, new List<IFilter> { filter }, new List<IMapping>()); // Act List<MethodData> methodDatas = sut.GetData().ToList(); // Assert Assert.Equal(5, methodDatas.Count); List<ErroredExecutionSetup> executionSetups = methodDatas.Select(m => m.ExecutionSetup).OfType<ErroredExecutionSetup>().ToList(); Assert.Equal(5, executionSetups.Count); foreach (ErroredExecutionSetup executionSetup in executionSetups) { var compositionException = Assert.IsType<CompositionException>(executionSetup.Exception); Assert.Same(exception, compositionException.InnerException); } }