public void ExtracPropertiesValues_SendTwoPeople_ShouldBeEquivilent()
        {
            var cache   = new PropertiesMetadataPropertiesCache(_logMocked);
            var person  = new PersonMockData();
            var teacher = new TeacherWithExceptionMock();


            var teacherArguments = cache.ParseIntoParams(teacher);
            var personArguments  = cache.ParseIntoParams(person);

            var personDissect = DissectPropertyInfoMetadata.GetMemberWithSensitivity(person).ToDictionary(x => x.Name);


            var count = AssertBetweenCacheParamAndDissectParams(personArguments, personDissect);

            _logMocked.DidNotReceive().Warn(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <object>(), Arg.Any <Exception>(), Arg.Any <bool>(), Arg.Any <string>(), Arg.Any <int>(), Arg.Any <string>());
            count.ShouldBe(personDissect.Count);


            var teacherDissect = DissectPropertyInfoMetadata.GetMemberWithSensitivity(teacher).ToDictionary(x => x.Name);

            count = AssertBetweenCacheParamAndDissectParams(teacherArguments, teacherDissect);
            count.ShouldBe(teacherDissect.Count - 1);
            _logMocked.Received().Warn(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <object>(), Arg.Any <Exception>(), Arg.Any <bool>(), Arg.Any <string>(), Arg.Any <int>(), Arg.Any <string>());
        }
예제 #2
0
        public void ExtractMembersToLog_ExtractSensitiveAndCryptic_ShouldBeEquivilent()
        {
            var mock = new PersonMockData();

            var metadataCacheParams = _extractor.ExtractMembersToLog(mock);
            var dissectedParams     = DissectPropertyInfoMetadata.GetMemberWithSensitivity(mock).ToDictionary(x => x.Name);

            int count = AssertBetweenCacheParamAndDissectParams(metadataCacheParams, dissectedParams);

            metadataCacheParams.Count().ShouldBe(dissectedParams.Count);
            count.ShouldBe(dissectedParams.Count);
        }
        public void ExtracPropertiesValues_ExtractSensitiveAndCryptic_ShouldBeEquivilent()
        {
            var mock  = new PersonMockData();
            var cache = new PropertiesMetadataPropertiesCache(_logMocked);


            var metadataCacheParams = cache.ParseIntoParams(mock);
            var dissectedParams     = DissectPropertyInfoMetadata.GetMemberWithSensitivity(mock).ToDictionary(x => x.Name);

            int count = AssertBetweenCacheParamAndDissectParams(metadataCacheParams, dissectedParams);

            metadataCacheParams.Count().ShouldBe(dissectedParams.Count);
            count.ShouldBe(dissectedParams.Count);
        }
예제 #4
0
        public void ExtractMembersToLog_ExtractSensitiveAndCrypticWithInheritenceAndException_ShouldBeEquivilent()
        {
            var mock = new TeacherWithExceptionMock();

            var dissectedParams = DissectPropertyInfoMetadata.GetMemberWithSensitivity(mock).ToDictionary(x => x.Name);

            var parseParams = _extractor.ExtractMembersToLog(mock);
            int count       = AssertBetweenCacheParamAndDissectParams(parseParams, dissectedParams);

            parseParams.Count().ShouldBe(dissectedParams.Count - 1);
            count.ShouldBe(dissectedParams.Count - 1);

            _logMocked.Received().Warn(Arg.Any <string>(), Arg.Any <object>(), Arg.Any <object>(), Arg.Any <Exception>(), Arg.Any <bool>(), Arg.Any <string>(), Arg.Any <int>(), Arg.Any <string>());
        }
예제 #5
0
        public void LoadTest()
        {
            var people          = GeneratePeople(10000).ToList();
            var numOfProperties = DissectPropertyInfoMetadata.GetMemberWithSensitivity(new PersonMockData());
            var stopWatch       = new Stopwatch();

            stopWatch.Start();

            foreach (var person in people)
            {
                var tmpParams = _extractor.ExtractMembersToLog(person);
                tmpParams.Count().ShouldBe(numOfProperties.Count());
            }
            stopWatch.Stop();
        }
        public void LoadTest()
        {
            var cache           = new PropertiesMetadataPropertiesCache(_logMocked);
            var people          = GeneratePeople(10000).ToList();
            var numOfProperties = DissectPropertyInfoMetadata.GetMemberWithSensitivity(new PersonMockData());
            var stopWatch       = new Stopwatch();

            stopWatch.Start();

            foreach (var person in people)
            {
                var tmpParams = cache.ParseIntoParams(person);
                tmpParams.Count().ShouldBe(numOfProperties.Count());
            }
            stopWatch.Stop();
        }