Example #1
0
        /// <summary>
        /// Initialise the bootstrapper
        /// </summary>
        /// <param name="filter">a series of filters</param>
        /// <param name="commandLine">command line options needed by other components</param>
        /// <param name="persistance">a persistence object</param>
        /// <param name="perfCounters"></param>
        public void Initialise(IFilter filter,
                               ICommandLine commandLine,
                               IPersistance persistance,
                               IPerfCounters perfCounters)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(_logger);
            builder.RegisterInstance(filter);
            builder.RegisterInstance(commandLine);
            builder.RegisterInstance(persistance);
            builder.RegisterInstance(perfCounters);

            builder.RegisterType <TrackedMethodStrategyManager>().As <ITrackedMethodStrategyManager>().SingleInstance();
            builder.RegisterType <InstrumentationModelBuilderFactory>().As <IInstrumentationModelBuilderFactory>();
            builder.RegisterType <CommunicationManager>().As <ICommunicationManager>();
            builder.RegisterType <ProfilerManager>().As <IProfilerManager>();
            builder.RegisterType <ProfilerCommunication>().As <IProfilerCommunication>();

            builder.RegisterType <MarshalWrapper>().As <IMarshalWrapper>();
            builder.RegisterType <MemoryManager>().As <IMemoryManager>().SingleInstance();
            builder.RegisterType <MessageHandler>().As <IMessageHandler>();

            _container = builder.Build();
        }
        public AccountViewModel()
        {
            AddUserCommand = new RelayCommand(AddUser);
            persistance    = Singleton <IPersistance> .GetInstance();

            ListUsers = new ObservableCollection <User>(Singleton <IPersistance> .GetInstance().GetUsersDB());
        }
        public LoginDialogViewModel(IDialogCoordinator instance, IDialog dialog)
        {
            persistance = Singleton <IPersistance> .GetInstance();

            LoginCommand           = new RelayCommand(Login);
            this.dialogCoordinator = instance;
            activeDialog           = dialog;
        }
Example #4
0
 /// <summary>
 ///  Galan Ionut Andrei
 ///  Return persistance layer instance using Singleton Design.
 /// </summary>
 public static IPersistance getInstanceOfMySqlConnection()
 {
     if (_persistance == null)
     {
         _persistance = new Persistance();
     }
     return(_persistance);
 }
 public ProfilerCommunication(IFilter filter,
                              IPersistance persistance,
                              IInstrumentationModelBuilderFactory instrumentationModelBuilderFactory)
 {
     _filter      = filter;
     _persistance = persistance;
     _instrumentationModelBuilderFactory = instrumentationModelBuilderFactory;
 }
        public DetteViewModel()
        {
            persistance = Singleton <IPersistance> .GetInstance();

            Singleton <Event> .GetInstance().OnChangeUser += updateInfo;

            ShowAllCommand = new RelayCommand(ShowAll);
        }
Example #7
0
 public ChangePassword(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     _persistance = persistance;
 }
Example #8
0
 public Connect(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException(nameof(persistance));
     }
     _persistance = persistance;
 }
Example #9
0
    public MySeviceData(IPersistance persistance)
    {
        if (persistance == null)
        {
            throw new ArgumentNullException("persistance");
        }

        _persistance = persistance;
    }
Example #10
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance, 
     IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance = persistance;
     _memoryManager = memoryManager;
     _commandLine = commandLine;
     _perfCounters = perfCounters;
 }
Example #11
0
        public HistorySaleViewModel()
        {
            this.persistance = Singleton <IPersistance> .GetInstance();

            var ticketList = persistance.GetTicketsDB();

            TicketList          = new ObservableCollection <Ticket>(ticketList);
            CancelTicketCommand = new RelayCommand(cancelTicket);
        }
Example #12
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance,
                        IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance          = persistance;
     _memoryManager        = memoryManager;
     _commandLine          = commandLine;
     _perfCounters         = perfCounters;
 }
 public ProfilerManagerFactory(ICommunicationManager communicationManager,
                               IPersistance persistance,
                               IMemoryManager memoryManager,
                               ICommandLine commandLine)
 {
     _communicationManager = communicationManager;
     _persistance          = persistance;
     _memoryManager        = memoryManager;
     _commandLine          = commandLine;
 }
Example #14
0
        /// <summary>
        /// Constructeur. Prend IPersistance en parametre a qui le manager delegue la gestion de la persistence.
        /// Les alcools sont charges depuis json et les notes des alcools mises a jour en fonction des notes des avis.
        /// </summary>
        /// <param name="pers"></param>
        public Manager(IPersistance pers)
        {
            persistance = pers;
            ChargerFichier();

            AlcoolsAffiche = new ObservableCollection <Alcool>(livreAlcool.ListAlcool);
            TypesAlcool    = new ReadOnlyCollection <TypeAlcool>(Enum.GetValues(typeof(TypeAlcool)).Cast <TypeAlcool>().ToList());

            UpdateNoteAvis();
        }
Example #15
0
 public SaMode(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
 }
Example #16
0
 public void Initialise(IFilter filter, ICommandLine commandLine, IPersistance persistance)
 {
     _container.RegisterInstance(filter);
     _container.RegisterInstance(commandLine);
     _container.RegisterInstance(persistance);
     _container.RegisterType<IProfilerCommunication, ProfilerCommunication>();
     _container.RegisterType<IInstrumentationModelBuilderFactory, InstrumentationModelBuilderFactory>();
     _container.RegisterType<IProfilerManager, ProfilerManager>();
     _container.RegisterType<IMessageHandler, MessageHandler>();
     _container.RegisterType<IMarshalWrapper, MarshalWrapper>();
 }
 public AddUserAsAdmin(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance = persistance;
 }
 public RemoveUserFromGroup(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance = persistance;
 }
Example #19
0
 public ShowGroupDetails(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance = persistance;
 }
 public DbBootStrapAddUsers(IPersistance persistance, IBotConfig botconfig)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (botconfig == null)
     {
         throw new ArgumentNullException("botconfig");
     }
     _persistance = persistance;
     _botconfig   = botconfig;
 }
Example #21
0
        public ChoiceBDEViewModel(IDialogCoordinator instance, Collection <BasketItem> items, IDialog dialog, MainWindow main, float reduc)
        {
            persistance = Singleton <IPersistance> .GetInstance();

            this.dialog       = dialog;
            ListBDE           = new Collection <BDE>(persistance.GetBDEList().Where(b => b.Account.ID == Singleton <User> .GetInstance().Account.ID).ToList <BDE>());
            PickBDE           = new RelayCommand <BDE>(addBasketToDB);
            dialogCoordinator = instance;
            CancelChoice      = new RelayCommand(cancelChoice);
            baskets           = items;
            this.main         = main;
            this.reduction    = reduc;
        }
 public DeleteKillUser(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance          = persistance;
     _ircReadWriteExchange = ircReadWriteExchange;
 }
 public IrcSecuritySweep(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance          = persistance;
     _ircReadWriteExchange = ircReadWriteExchange;
 }
        public ProductListViewModel(IDialogCoordinator dialogCoordinator)
        {
            persistance = Singleton <IPersistance> .GetInstance();

            ProductsView            = new ObservableCollection <Product>(persistance.GetProductList() as Collection <Product>);
            ModifyCommand           = new RelayCommand(ModifyProduct);
            ConfirmCommand          = new RelayCommand(ConfirmEdit);
            CancelCommand           = new RelayCommand(CancelEdit);
            SortCommand             = new RelayCommand <string>(sortProductView);
            AddProductToListCommand = new RelayCommand(AddProductToList);
            DeleteProductCommand    = new RelayCommand(DeleteProduct);
            listTickets             = persistance.GetTicketsDB();
            this.dialogCoordinator  = dialogCoordinator;
        }
        public void SetUp()
        {
            _filter = new Filter();
            _filter.AddFilter("-[mscorlib]*");
            _filter.AddFilter("-[System]*");
            _filter.AddFilter("-[System.*]*");
            _filter.AddFilter("-[Microsoft.VisualBasic]*");
            _filter.AddFilter("+[OpenCover.Samples.*]*");

            _commandLine = new Mock<ICommandLine>();

            var filePersistance = new BasePersistanceStub(_commandLine.Object);
            _persistance = filePersistance;
        }
Example #26
0
 public void InitializeTest()
 {
     _persistance       = Mock.Create <IPersistance>();
     _dateTime          = Mock.Create <IDateTimeProvider>();
     _navigationService = Mock.Create <INavigationService>();
     _modelFactory      = Mock.Create <IModelFactory>();
     _taskService       = new TaskService
     {
         Persistance      = _persistance,
         DateTimeProvider = _dateTime,
         ModelFactory     = _modelFactory,
         Navigation       = _navigationService,
     };
     _habitViewModel = Mock.Create <ITaskViewModel>();
 }
Example #27
0
 /// <summary>
 /// Initialise the bootstrapper
 /// </summary>
 /// <param name="filter">a series of filters</param>
 /// <param name="commandLine">command line options needed by other components</param>
 /// <param name="persistance">a persistence object</param>
 public void Initialise(IFilter filter, ICommandLine commandLine, IPersistance persistance, IMemoryManager memoryManager)
 {
     _container.RegisterInstance(_logger);
     _container.RegisterInstance(filter);
     _container.RegisterInstance(commandLine);
     _container.RegisterInstance(persistance);
     _container.RegisterInstance(memoryManager);
     _container.RegisterType<IInstrumentationModelBuilderFactory, InstrumentationModelBuilderFactory>();
     _container.RegisterType<IProfilerManager, ProfilerManager>();
     _container.RegisterType<IProfilerCommunication, ProfilerCommunication>();
     _container.RegisterType<IMessageHandler, MessageHandler>();
     _container.RegisterType<IMarshalWrapper, MarshalWrapper>();
     _container.RegisterType<ITrackedMethodStrategy, TrackNUnitTestMethods>(typeof(TrackNUnitTestMethods).FullName);
     _container.RegisterType<ITrackedMethodStrategy, TrackMSTestTestMethods>(typeof(TrackMSTestTestMethods).FullName);
 }
 protected AbstractIrcCommand(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     _persistance          = persistance;
     _ircReadWriteExchange = ircReadWriteExchange;
     Messages     = new List <string>();
     Mapping      = new Dictionary <TArguments, string>();
     OperCommands = new List <IOperCommand>();
 }
Example #29
0
 public Help(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange, ILifetimeScope scope) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     if (scope == null)
     {
         throw new ArgumentNullException("scope");
     }
     _scope = scope;
 }
Example #30
0
        public void SetUp()
        {
            _filter = new Filter(false);
            _filter.AddFilter("-[mscorlib]*");
            _filter.AddFilter("-[System]*");
            _filter.AddFilter("-[System.*]*");
            _filter.AddFilter("-[Microsoft.VisualBasic]*");
            _filter.AddFilter("+[OpenCover.Samples.*]*");

            _commandLine = new Mock <ICommandLine>();
            _logger      = new Mock <ILog>();

            var filePersistance = new BasePersistanceStub(_commandLine.Object, _logger.Object);

            _persistance = filePersistance;
        }
Example #31
0
    private void SetupPersistence()
    {
        switch (pType)
        {
        case PersistenceType.LOCAL_SYNCHRO:
            persistence = new FilePersistanceQueued(serializer, id);
            break;

        case PersistenceType.LOCAL_ASYNCHO:
            persistence = new FilePersistanceQueued(serializer, id);
            break;

        case PersistenceType.SERVER_ASYNCHRO:
            persistence = new FilePersistanceServer(serializer, id);
            break;
        }
    }
Example #32
0
 public ShowUsers(IPersistance persistance, IIrcReadWriteExchange ircReadWriteExchange, UserDisplay userDisplay) : base(persistance, ircReadWriteExchange)
 {
     if (persistance == null)
     {
         throw new ArgumentNullException("persistance");
     }
     if (ircReadWriteExchange == null)
     {
         throw new ArgumentNullException("ircReadWriteExchange");
     }
     if (userDisplay == null)
     {
         throw new ArgumentNullException("userDisplay");
     }
     _persistance = persistance;
     _userDisplay = userDisplay;
 }
Example #33
0
        /// <summary>
        /// Crée un jeu de 2 Dés avec un classement
        /// </summary>
        public Jeu(TypePersistance type)
        {
            //A la création du jeu : les 2 dés sont crées
            //On aurait pu créer les 2 Des juste au moment de jouer
            _Des[0] = new De();
            _Des[1] = new De();

            _Persistance = ClassementFactory.CreerPersistance(type);


            _Classement = new Classement();
            var recup = (Classement)_Persistance.LoadClassement(typeof(Classement));

            if (recup != null)
            {
                _Classement = recup;
            }
        }
Example #34
0
        public CaisseViewModel(IDialogCoordinator instance, MainWindow main)
        {
            BasketItems             = new ObservableCollection <BasketItem>();
            AddProductCommand       = new RelayCommand <Product>(AddProductToBasket);
            ClearBasketCommand      = new RelayCommand(ClearBasket);
            DeleteBasketItemCommand = new RelayCommand(DeleteBasketItem);
            this.dialogCoordinator  = instance;
            this.persistance        = Singleton <IPersistance> .GetInstance();

            this.main = main;
            //LoadProducts();
            currEvent = Singleton <Event> .GetInstance();

            currEvent.OnUpdateProduct += OnUpdateProduct;
            currEvent.OnClearBasket   += OnClearBasket;
            EncaisseCommand            = new RelayCommand(startEncaisse);
            SortCommand = new RelayCommand <string>(SortList);
        }
Example #35
0
 public ProfilerManager(IMessageHandler messageHandler, IPersistance persistance, IMemoryManager memoryManager)
 {
     _messageHandler = messageHandler;
     _persistance = persistance;
     _memoryManager = memoryManager;
 }
Example #36
0
        private static void DisplayResults(IPersistance persistance, ICommandLine parser)
        {
            var CoverageSession = persistance.CoverageSession;

            var totalClasses = 0;
            var visitedClasses = 0;

            var altTotalClasses = 0;
            var altVisitedClasses = 0;

            var totalSeqPoint = 0;
            var visitedSeqPoint = 0;
            var totalMethods = 0;
            var visitedMethods = 0;

            var altTotalMethods = 0;
            var altVisitedMethods = 0;

            var totalBrPoint = 0;
            var visitedBrPoint = 0;

            var unvisitedClasses = new List<string>();
            var unvisitedMethods = new List<string>();

            if (CoverageSession.Modules != null)
            {
                foreach (var @class in
                    from module in CoverageSession.Modules
                    from @class in module.Classes
                    select @class)
                {
                    if ((@class.Methods.Where(x => x.SequencePoints.Where(y => y.VisitCount > 0).Any()).Any()))
                    {
                        visitedClasses += 1;
                        totalClasses += 1;
                    }
                    else if ((@class.Methods.Where(x => x.FileRef != null).Any()))
                    {
                        totalClasses += 1;
                        unvisitedClasses.Add(@class.FullName);
                    }

                    if (@class.Methods.Where(x => x.Visited).Any())
                    {
                        altVisitedClasses += 1;
                        altTotalClasses += 1;
                    }
                    else if (@class.Methods.Any())
                    {
                        altTotalClasses += 1;
                    }

                    if (@class.Methods == null) continue;

                    foreach (var method in @class.Methods)
                    {
                        if ((method.SequencePoints.Where(x => x.VisitCount > 0).Any()))
                        {
                            visitedMethods += 1;
                            totalMethods += 1;
                        }
                        else if (method.FileRef != null)
                        {
                            totalMethods += 1;
                            unvisitedMethods.Add(string.Format("{0}", method.Name));
                        }

                        altTotalMethods += 1;
                        if (method.Visited)
                        {
                            altVisitedMethods += 1;
                        }

                        totalSeqPoint += method.SequencePoints.Count();
                        visitedSeqPoint += method.SequencePoints.Where(pt => pt.VisitCount != 0).Count();

                        totalBrPoint += method.BranchPoints.Count();
                        visitedBrPoint += method.BranchPoints.Where(pt => pt.VisitCount != 0).Count();
                    }
                }
            }

            if (totalClasses > 0)
            {
                System.Console.WriteLine("Visited Classes {0} of {1} ({2})", visitedClasses,
                                  totalClasses, (double)visitedClasses * 100.0 / (double)totalClasses);
                System.Console.WriteLine("Visited Methods {0} of {1} ({2})", visitedMethods,
                                  totalMethods, (double)visitedMethods * 100.0 / (double)totalMethods);
                System.Console.WriteLine("Visited Points {0} of {1} ({2})", visitedSeqPoint,
                                  totalSeqPoint, (double)visitedSeqPoint * 100.0 / (double)totalSeqPoint);
                System.Console.WriteLine("Visited Branches {0} of {1} ({2})", visitedBrPoint,
                                  totalBrPoint, (double)visitedBrPoint * 100.0 / (double)totalBrPoint);

                System.Console.WriteLine("");
                System.Console.WriteLine(
                    "==== Alternative Results (includes all methods including those without corresponding source) ====");
                System.Console.WriteLine("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses,
                                  altTotalClasses, (double)altVisitedClasses * 100.0 / (double)altTotalClasses);
                System.Console.WriteLine("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods,
                                  altTotalMethods, (double)altVisitedMethods * 100.0 / (double)altTotalMethods);

                if (parser.ShowUnvisited)
                {
                    System.Console.WriteLine("");
                    System.Console.WriteLine("====Unvisited Classes====");
                    foreach (var unvisitedClass in unvisitedClasses)
                    {
                        System.Console.WriteLine(unvisitedClass);
                    }

                    System.Console.WriteLine("");
                    System.Console.WriteLine("====Unvisited Methods====");
                    foreach (var unvisitedMethod in unvisitedMethods)
                    {
                        System.Console.WriteLine(unvisitedMethod);
                    }
                }
            }
            else
            {
                System.Console.WriteLine("No results - no assemblies that matched the supplied filter were instrumented (missing PDBs?)");
            }
        }
Example #37
0
 public ProfilerManager(IMessageHandler messageHandler, IPersistance persistance)
 {
     _messageHandler = messageHandler;
     _persistance = persistance;
 }
Example #38
0
        private static int RunWithContainer(CommandLineParser parser, Bootstrapper container, IPersistance persistance)
        {
            var returnCode = 0;
            var registered = false;

            try
            {
                if (parser.Register)
                {
                    ProfilerRegistration.Register(parser.Registration);
                    registered = true;
                }

                var harness = container.Resolve<IProfilerManager>();

                var servicePrincipal =
                    (parser.Service
                        ? new[] {ServiceEnvironmentManagement.MachineQualifiedServiceAccountName(parser.Target)}
                        : new string[0]).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();

                harness.RunProcess(environment =>
                {
                    if (parser.Service)
                    {
                        RunService(parser, environment, Logger);
                        returnCode = 0;
                    }
                    else
                    {
                        returnCode = RunProcess(parser, environment);
                    }
                }, servicePrincipal);

                DisplayResults(persistance, parser, Logger);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(string.Format("Exception: {0}\n{1}", ex.Message, ex.InnerException));
                throw;
            }
            finally
            {
                if (parser.Register && registered)
                    ProfilerRegistration.Unregister(parser.Registration);
            }
            return returnCode;
        }
Example #39
0
        private static void DisplayResults(IPersistance persistance, ICommandLine parser, ILog logger)
        {
            if (!logger.IsInfoEnabled) return;

            var CoverageSession = persistance.CoverageSession;

            var totalClasses = 0;
            var visitedClasses = 0;

            var altTotalClasses = 0;
            var altVisitedClasses = 0;

            var totalMethods = 0;
            var visitedMethods = 0;

            var altTotalMethods = 0;
            var altVisitedMethods = 0;

            var unvisitedClasses = new List<string>();
            var unvisitedMethods = new List<string>();

            if (CoverageSession.Modules != null)
            {
                foreach (var @class in
                    from module in CoverageSession.Modules.Where(x=>x.Classes != null)
                    from @class in module.Classes.Where(c => !c.ShouldSerializeSkippedDueTo())
                    select @class)
                {
                    if (@class.Methods == null) continue;

                    if ((@class.Methods.Any(x => !x.ShouldSerializeSkippedDueTo() && x.SequencePoints.Any(y => y.VisitCount > 0))))
                    {
                        visitedClasses += 1;
                        totalClasses += 1;
                    }
                    else if ((@class.Methods.Any(x => x.FileRef != null)))
                    {
                        totalClasses += 1;
                        unvisitedClasses.Add(@class.FullName);
                    }

                    if (@class.Methods.Any(x => x.Visited))
                    {
                        altVisitedClasses += 1;
                        altTotalClasses += 1;
                    }
                    else if (@class.Methods.Any())
                    {
                        altTotalClasses += 1;
                    }

                    foreach (var method in @class.Methods.Where(x=> !x.ShouldSerializeSkippedDueTo()))
                    {
                        if ((method.SequencePoints.Any(x => x.VisitCount > 0)))
                        {
                            visitedMethods += 1;
                            totalMethods += 1;
                        }
                        else if (method.FileRef != null)
                        {
                            totalMethods += 1;
                            unvisitedMethods.Add(string.Format("{0}", method.Name));
                        }

                        altTotalMethods += 1;
                        if (method.Visited)
                        {
                            altVisitedMethods += 1;
                        }
                    }
                }
            }

            if (totalClasses > 0)
            {
                logger.InfoFormat("Visited Classes {0} of {1} ({2})", visitedClasses,
                                  totalClasses, Math.Round(visitedClasses * 100.0 / totalClasses, 2));
                logger.InfoFormat("Visited Methods {0} of {1} ({2})", visitedMethods,
                                  totalMethods, Math.Round(visitedMethods * 100.0 / totalMethods, 2));
                logger.InfoFormat("Visited Points {0} of {1} ({2})", CoverageSession.Summary.VisitedSequencePoints,
                                  CoverageSession.Summary.NumSequencePoints, CoverageSession.Summary.SequenceCoverage);
                logger.InfoFormat("Visited Branches {0} of {1} ({2})", CoverageSession.Summary.VisitedBranchPoints,
                                  CoverageSession.Summary.NumBranchPoints, CoverageSession.Summary.BranchCoverage);

                logger.InfoFormat("");
                logger.InfoFormat(
                    "==== Alternative Results (includes all methods including those without corresponding source) ====");
                logger.InfoFormat("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses,
                                  altTotalClasses, Math.Round(altVisitedClasses * 100.0 / altTotalClasses, 2));
                logger.InfoFormat("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods,
                                  altTotalMethods, Math.Round(altVisitedMethods * 100.0 / altTotalMethods, 2));

                if (parser.ShowUnvisited)
                {
                    logger.InfoFormat("");
                    logger.InfoFormat("====Unvisited Classes====");
                    foreach (var unvisitedClass in unvisitedClasses)
                    {
                        logger.InfoFormat(unvisitedClass);
                    }

                    logger.InfoFormat("");
                    logger.InfoFormat("====Unvisited Methods====");
                    foreach (var unvisitedMethod in unvisitedMethods)
                    {
                        logger.InfoFormat(unvisitedMethod);
                    }
                }
            }
            else
            {
                logger.InfoFormat("No results - no assemblies that matched the supplied filter were instrumented");
                logger.InfoFormat("    this could be due to missing PDBs for the assemblies that match the filter");
                logger.InfoFormat("    please review the output file and refer to the Usage guide (Usage.rtf)");
            }
        }
Example #40
0
        private static void DisplayResults(IPersistance persistance, ICommandLine parser, ILog logger)
        {
            if (!logger.IsInfoEnabled) return;

            var coverageSession = persistance.CoverageSession;

            var altTotalClasses = 0;
            var altVisitedClasses = 0;

            var altTotalMethods = 0;
            var altVisitedMethods = 0;

            var unvisitedClasses = new List<string>();
            var unvisitedMethods = new List<string>();

            if (coverageSession.Modules != null)
            {
                foreach (var @class in
                    from module in coverageSession.Modules.Where(x=>x.Classes != null)
                    from @class in module.Classes.Where(c => !c.ShouldSerializeSkippedDueTo())
                    select @class)
                {
                    if (@class.Methods == null) continue;

                    if ((@class.Methods.Any(x => !x.ShouldSerializeSkippedDueTo() && x.SequencePoints.Any(y => y.VisitCount > 0))))
                    {
                    }
                    else if ((@class.Methods.Any(x => x.FileRef != null)))
                    {
                        unvisitedClasses.Add(@class.FullName);
                    }

                    if (@class.Methods.Any(x => x.Visited))
                    {
                        altVisitedClasses += 1;
                        altTotalClasses += 1;
                    }
                    else if (@class.Methods.Any())
                    {
                        altTotalClasses += 1;
                    }

                    foreach (var method in @class.Methods.Where(x=> !x.ShouldSerializeSkippedDueTo()))
                    {
                        if ((method.SequencePoints.Any(x => x.VisitCount > 0)))
                        {
                        }
                        else if (method.FileRef != null)
                        {
                            unvisitedMethods.Add(string.Format("{0}", method.Name));
                        }

                        altTotalMethods += 1;
                        if (method.Visited)
                        {
                            altVisitedMethods += 1;
                        }
                    }
                }
            }

            if (coverageSession.Summary.NumClasses > 0)
            {
                logger.InfoFormat("Visited Classes {0} of {1} ({2})", coverageSession.Summary.VisitedClasses,
                                  coverageSession.Summary.NumClasses, Math.Round(coverageSession.Summary.VisitedClasses * 100.0 / coverageSession.Summary.NumClasses, 2));
                logger.InfoFormat("Visited Methods {0} of {1} ({2})", coverageSession.Summary.VisitedMethods,
                                  coverageSession.Summary.NumMethods, Math.Round(coverageSession.Summary.VisitedMethods * 100.0 / coverageSession.Summary.NumMethods, 2));
                logger.InfoFormat("Visited Points {0} of {1} ({2})", coverageSession.Summary.VisitedSequencePoints,
                                  coverageSession.Summary.NumSequencePoints, coverageSession.Summary.SequenceCoverage);
                logger.InfoFormat("Visited Branches {0} of {1} ({2})", coverageSession.Summary.VisitedBranchPoints,
                                  coverageSession.Summary.NumBranchPoints, coverageSession.Summary.BranchCoverage);

                logger.InfoFormat("");
                logger.InfoFormat(
                    "==== Alternative Results (includes all methods including those without corresponding source) ====");
                logger.InfoFormat("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses,
                                  altTotalClasses, Math.Round(altVisitedClasses * 100.0 / altTotalClasses, 2));
                logger.InfoFormat("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods,
                                  altTotalMethods, Math.Round(altVisitedMethods * 100.0 / altTotalMethods, 2));

                if (parser.ShowUnvisited)
                {
                    logger.InfoFormat("");
                    logger.InfoFormat("====Unvisited Classes====");
                    foreach (var unvisitedClass in unvisitedClasses)
                    {
                        logger.InfoFormat(unvisitedClass);
                    }

                    logger.InfoFormat("");
                    logger.InfoFormat("====Unvisited Methods====");
                    foreach (var unvisitedMethod in unvisitedMethods)
                    {
                        logger.InfoFormat(unvisitedMethod);
                    }
                }
            }
            else
            {
                logger.InfoFormat("No results, this could be for a number of reasons. The most common reasons are:");
                logger.InfoFormat("    1) missing PDBs for the assemblies that match the filter please review the");
                logger.InfoFormat("    output file and refer to the Usage guide (Usage.rtf) about filters.");
                logger.InfoFormat("    2) the profiler may not be registered correctly, please refer to the Usage");
                logger.InfoFormat("    guide and the -register switch.");
            }
        }