예제 #1
0
        public string[] Assert_that_query_history_updated_appropriately(string[][] queryNames)
        {
            var sqlServerToMonitor = new SqlServerEndpoint("Best_DB_Ever", "", false);

            Assert.That(sqlServerToMonitor.QueryHistory.Count, Is.EqualTo(0), "History Should start off empty");

            queryNames.ForEach(queryNamesPass =>
            {
                IQueryContext[] queryContexts = queryNamesPass.Select(queryName =>
                {
                    var queryContext = Substitute.For <IQueryContext>();
                    queryContext.QueryName.Returns(queryName);
                    return(queryContext);
                }).ToArray();
                sqlServerToMonitor.UpdateHistory(queryContexts);
            });

            string[] actual = sqlServerToMonitor.QueryHistory.Select(qh => string.Format("{0}:{1}", qh.Key, qh.Value.Count)).ToArray();

            return(actual);
        }
        public string[] Assert_that_query_history_updated_appropriately(string[][] queryNames)
        {
            var sqlServerToMonitor = new SqlServerEndpoint("Best_DB_Ever", "", false);

            Assert.That(sqlServerToMonitor.QueryHistory.Count, Is.EqualTo(0), "History Should start off empty");

            queryNames.ForEach(queryNamesPass =>
                               {
                                   IQueryContext[] queryContexts = queryNamesPass.Select(queryName =>
                                                                                         {
                                                                                             var queryContext = Substitute.For<IQueryContext>();
                                                                                             queryContext.QueryName.Returns(queryName);
                                                                                             return queryContext;
                                                                                         }).ToArray();
                                   sqlServerToMonitor.UpdateHistory(queryContexts);
                               });

            string[] actual = sqlServerToMonitor.QueryHistory.Select(qh => string.Format("{0}:{1}", qh.Key, qh.Value.Count)).ToArray();

            return actual;
        }