public void AccessingMethodFromNonPublicTypeIsDetected() { var expr = new PrivateNestedClass().GenerateExpression(); var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void ExpressionUsingInternalTypesIsDetected() { Expression <Func <InternalSource, InternalDest, int> > expr = (a, b) => a.Foo + b.Bar; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void ExpressionUsingPublicTypesIsNotDetected() { Expression <Func <PublicSource, PublicDest, int> > expr = (a, b) => a.Foo + b.Bar; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsFalse(processor.NonPublicMembersAccessed); }
public void NonPublicInterfaceAccessIsDetected() { Expression <Func <ISource, Dest, bool> > expr = (a, b) => a.Valid & b.Valid; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void ExpressionNotUsingExternalOperationsIsNotDetected() { Expression <Func <int, int, int> > expr = (a, b) => a + b; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsFalse(processor.NonPublicMembersAccessed); }
public void AccessingPublicMethodIsNotDetected() { Expression <Func <int, int, int> > expr = (a, b) => Bar(); var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsFalse(processor.NonPublicMembersAccessed); }
public void ExpressionUsingGenericTypesIsDetected() { Expression <Func <GenericSource <int>, GenericDest <int>, int> > expr = (a, b) => a.Foo + b.Bar; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void AccessingCapturedVariableIsDetected() { var i = 1; Expression <Func <int, int, int> > expr = (a, b) => a + b + i; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void AccessingNonTrivialCapturedVariableIsDetected() { var info = new CultureInfo("en-US"); Expression <Func <int, int, int> > expr = (a, b) => a + b + info.EnglishName.Length; var processor = new MapProposalProcessor(new MemberMapper()); processor.Process(expr); Assert.IsTrue(processor.NonPublicMembersAccessed); }
public void NonPublicInterfaceAccessIsDetected_1() { var mapper = new MemberMapper(); mapper.Options.Debug.DebugInformationEnabled = true; mapper.CreateMap <ISource, Dest>(src => new Dest { Valid = !src.Valid }); var map = mapper.CreateMap <Source, Dest>(); var processor = new MapProposalProcessor(mapper); processor.Process(map.DebugInformation.MappingExpression); Assert.IsTrue(processor.NonPublicMembersAccessed); }