Esempio n. 1
0
        public async Task <IActionResult> GetDiffForStoredDocumentAsync(Guid id, bool unchanged)
        {
            GrouperDocumentEntry entry = (await GetDocumentDb().GetEntriesByDocumentIdAsync(id)).FirstOrDefault();

            if (entry == null)
            {
                return(BadRequest());
            }
            Grouper         backend = GetGrouperBackend();
            GroupMemberDiff diff    = await backend.GetMemberDiffAsync(entry.Document, unchanged);

            return(Ok(diff));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> Post([NakedBody] string testStr) //[FromBody] string data)
        {
            if (String.IsNullOrEmpty(testStr))
            {
                testStr = Request.Content.ReadAsStringAsync().Result;
            }

            if (String.IsNullOrEmpty(testStr))
            {
                NameValueCollection nvc = Request.Content.ReadAsFormDataAsync().Result;
                foreach (string key in nvc)
                {
                    testStr += nvc[key].ToString();
                }
            }

            if (String.IsNullOrEmpty(testStr) && Request.Content.IsMimeMultipartContent())
            {
                Collection <HttpContent> hcc = Request.Content.ReadAsMultipartAsync().Result.Contents;
                foreach (var item in hcc)
                {
                    testStr += item.ReadAsStringAsync().Result;
                }
            }

            if (String.IsNullOrEmpty(testStr))
            {
#if DEBUG
                return(BadRequest("Empty Input String"));
#else
                return(Ok("0"));
#endif
            }
            else
            {
                try
                {
                    if (Request.Content.Headers.ContentType.MediaType.ToUpper().Contains("URLENCODED"))
                    {
                        testStr = WebUtility.UrlDecode(testStr);
                    }
                    Grouper grpr = new Grouper(testStr.ToString());
                    return(Ok(grpr.score().ToString()));
                }
                catch (Exception e)
                {
                    return(BadRequest("Error with the supplied data:\r\n" + e.ToString() +
                                      "\r\n" + testStr.ToString().Substring(0, (testStr.Length > 2000? 2000: testStr.Length))));
                }
            }
        }
Esempio n. 3
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers()
            .AddNewtonsoftJson();
            services.Configure <GrouperConfiguration>(Configuration.GetSection("Grouper"));
            GrouperConfiguration config = new GrouperConfiguration();

            ConfigurationBinder.Bind(Configuration.GetSection("Grouper"), config);
            services.AddSingleton <IStringResourceHelper, StringResourceHelper>();
            services.AddSingleton((_) =>
            {
                return(Grouper.CreateFromConfig(config));
            });
        }
Esempio n. 4
0
 private void SetGrouperTitleStyle(Grouper style, Control parent)
 {
     foreach (Control con in parent.Controls)
     {
         if (con is Grouper)
         {
             (con as Grouper).CloneGrouperStyle(V_TitleStyle);
         }
         if (con.Controls.Count > 0)
         {
             SetGrouperTitleStyle(style, con);
         }
     }
 }
        public void OrderIsPreserved()
        {
            Given("a", "0", "1");
            Given("b", "1", "2");
            Given("c", "2", "3");

            var actuals = new Grouper(_log).GroupRelatedZips(_zipToIds);

            Assert.AreEqual(1, actuals.Count);
            var actual   = actuals.First();
            var expected = ToSet("a", "b", "c");

            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        // TODO: Clean up and build API
        static void Main(string[] args)
        {
            var input = "35x-01x*4+91*0+3340/2-x";

            Console.WriteLine("Input: " + input);
            Console.WriteLine();

            Console.WriteLine();
            Console.WriteLine("Tokenized:");
            var tokenizer = new Tokenizer();
            var tokenized = tokenizer.Tokenize(input);

            List(tokenized);

            Console.WriteLine();
            Console.WriteLine("Expanded:");
            var expander = new Expander();
            var expanded = expander.Expand(tokenized);

            List(expanded);

            Console.WriteLine();
            Console.WriteLine("Grouped:");
            var grouper = new Grouper();
            var grouped = grouper.Group(expanded);

            List(grouped);

            Console.WriteLine();
            Console.WriteLine("Cleaned:");
            var cleaner = new Cleaner();
            var cleaned = cleaner.Clean(grouped);

            List(cleaned);

            Console.WriteLine("");
            Console.WriteLine("");

            Format(cleaned);

            var calc = new Calculator();
            var dict = new Dictionary <string, double>()
            {
                { "x", 2 }
            };

            Console.WriteLine("Variables: x=2");
            Console.WriteLine("Calculated: " + calc.Calculate(cleaned, dict));
        }
 public UpdateServiceHelper(Joiner joiner, Grouper grouper, TimeService timeService, IJsonDataService tripService,
                            IJsonDataService busStopService, IJsonDataService busLineService, IJsonDataService expeditionService,
                            IJsonDataService stopInTripService, BusStopModelService busStopModelService, IDocumentStoreRepository documentStoreRepository)
 {
     _joiner                  = joiner;
     _grouper                 = grouper;
     _timeService             = timeService;
     _tripService             = tripService;
     _busStopService          = busStopService;
     _busLineService          = busLineService;
     _expeditionService       = expeditionService;
     _stopInTripService       = stopInTripService;
     _busStopModelService     = busStopModelService;
     _documentStoreRepository = documentStoreRepository;
 }
        public IEnumerable <GroupCalculation> Calculate(Grouping grouping, IEnumerable <Person> people)
        {
            var groups = Grouper.Group(grouping, people);

            return
                (groups
                 .Select(g =>
                         new GroupCalculation
            {
                Grouping = grouping,
                Person = g.Person,
                PersonInterest = SimpleInterestCalculator.Calculate(g.Person),
                Resolvers = g.Resolvers.Select(r => (r, SimpleInterestCalculator.Calculate(r)))
                            .ToList(),
            })
        public IObservable <IImmutableGroupChangeSet <TObject, TKey, TGroupKey> > Run()
        {
            return(Observable.Create <IImmutableGroupChangeSet <TObject, TKey, TGroupKey> >(
                       observer =>
            {
                var locker = new object();
                var grouper = new Grouper(_groupSelectorKey);

                var groups = _source.Synchronize(locker).Select(grouper.Update).Where(changes => changes.Count != 0);

                var regroup = _regrouper.Synchronize(locker).Select(_ => grouper.Regroup()).Where(changes => changes.Count != 0);

                return groups.Merge(regroup).SubscribeSafe(observer);
            }));
        }
Esempio n. 10
0
 public void SetGroupBoxStyle(Grouper ts)
 {
     try
     {
         this.m_BaseSetting.GrouperTitleStyle        = ts;
         this.m_CalibrationSetting.GrouperTitleStyle = ts;
         this.m_epsonBaseSetting.GrouperTitleStyle   = ts;
         this.m_MoveSetting.GrouperTitleStyle        = ts;
         this.spotColorSetting1.SetGroupBoxStyle(ts);
         this.m_Printer3DSetting.SetGroupBoxStyle(ts);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Create a Recognition Manager for the given sketch panel with default settings.
        /// Settings are loaded from "settings.txt".
        /// </summary>
        /// <param name="p">a sketch panel to manage</param>
        public RecognitionManager()
        {
            // Load settings from text file
            string directory        = AppDomain.CurrentDomain.BaseDirectory;
            string SettingsFilename = directory + "//settings.txt";

            _filenames = Files.SettingsReader.readSettings(SettingsFilename);

            // Initialize the recognition machines
            _domain           = ContextDomain.CircuitDomain.GetInstance();
            _strokeClassifier = RecognitionPipeline.createDefaultClassifier();
            _strokeGrouper    = RecognitionPipeline.createDefaultGrouper();
            _sketchRecognizer = RecognitionPipeline.createDefaultRecognizer();
            _connector        = RecognitionPipeline.createDefaultConnector();
            _refinement       = RecognitionPipeline.createDefaultRefiner();
        }
Esempio n. 12
0
 public void SetGroupBoxStyle(Grouper ts)
 {
     //if (ts == null)
     //    return;
     ////foreach(Control con in this.tabPage_setting.Controls)
     //foreach (Control con in this.splitContainer3.Controls)
     //{
     //    if (con is Grouper)
     //    {
     //        (con as Grouper).CloneGrouperStyle(ts);
     //    }
     //}
     ////			this.groupBox1.CloneGrouperStyle(ts);
     ////			this.groupBoxMultiCopy.CloneGrouperStyle(ts);
     ////			this.groupBoxOthers.CloneGrouperStyle(ts);
     ////			this.groupBoxRegion.CloneGrouperStyle(ts);
 }
        private void ExpectSpecific(IDictionary <string, IKaVESet <string> > zipToIds,
                                    params IKaVESet <string>[] expecteds)
        {
            var actuals = new Grouper(_log).GroupRelatedZips(zipToIds);

            if (expecteds.Length != actuals.Count)
            {
                Assert.Fail("incorrect number of groups, expected {0}, but was {1}", expecteds.Length, actuals.Count);
            }
            foreach (var expected in expecteds)
            {
                if (!actuals.Contains(expected))
                {
                    Assert.Fail("expected to find {0} in {1}", expected, actuals);
                }
            }
        }
Esempio n. 14
0
        public void Update(string id, Grouper item)
        {
            var connection = new Connection(Bancos.Sgq);

            if (item.name == null)
            {
                item.name = "";
            }

            if (item.executiveSummary == null)
            {
                item.executiveSummary = "";
            }

            bool resultado = false;

            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (id == "0")
            {
                throw new ArgumentNullException("id");
            }
            using (SqlCommand command = new SqlCommand())
            {
                command.Connection  = connection.connection;
                command.CommandText = @"
                    update SGQ_Groupers
                    set
                        name = @name,
                        type = @type,
                        executiveSummary = @executiveSummary
                    where
                        id = @id";
                command.Parameters.AddWithValue("id", item.id);
                command.Parameters.AddWithValue("name", item.name);
                command.Parameters.AddWithValue("type", item.type);
                command.Parameters.AddWithValue("executiveSummary", item.executiveSummary);

                int i = command.ExecuteNonQuery();
                resultado = i > 0;
            }
            connection.Dispose();
        }
Esempio n. 15
0
        public void ShouldGroupBy3()
        {
            var items = new []{1,2,3,4,5,6};
            var dic = new Dictionary<int, string> {{1, "true"},{0, "false"}};
            var grouper = new Grouper<int>(items, dic, x=>x==3 ? 1: 0);
            var groups = grouper.GetGroups();
            Assert.AreEqual(2, groups.Count());

            var falseItems = groups.Where(x => x.ID == 0).Single();
            Assert.AreEqual(0,falseItems.ID);
            Assert.AreEqual(5, falseItems.Items.Count());
            Assert.AreEqual("false", falseItems.Description);

            var trueItems = groups.Where(x => x.ID == 1).Single();
            Assert.AreEqual(1, trueItems.ID);
            Assert.AreEqual(1, trueItems.Items.Count());
            Assert.AreEqual("true", trueItems.Description);
        }
Esempio n. 16
0
        static async void ConfigureUpdateDataService()
        {
            var documentStoreRepository   = new DocumentStoreRepository();
            var publicTransportRepository = new PublicTransportRepository();

            UpdateDataService.DocumentStoreRepository = documentStoreRepository;

            var delayJsonService = new DelayJsonService(publicTransportRepository);

            DelaysHub.DelayService = new DelayService(delayJsonService);
            DelayService.DocumentStoreRepository = documentStoreRepository;

            var timeService = new DCNC.Service.PublicTransport.Time.TimeService();

            var stopComparer       = new StopComparer();
            var combineHelper      = new CombineHelper(stopComparer);
            var combiner           = new Combiner(combineHelper);
            var combineTripService = new CombineTripService(combiner);

            var joinTripMappingService = new JoinTripMappingService();

            var organizer  = new Organizer();
            var stopHelper = new StopHelper();
            var tripsWithBusStopsService = new TripsWithBusStopsService(organizer, stopHelper);
            var joiner = new Joiner(combineTripService, joinTripMappingService, tripsWithBusStopsService);

            var grouper = new Grouper();

            var tripService         = new TripService(documentStoreRepository, publicTransportRepository);
            var busStopService      = new BusStopService(documentStoreRepository, publicTransportRepository);
            var busLineService      = new BusLineService(documentStoreRepository, publicTransportRepository);
            var expeditionService   = new ExpeditionService(documentStoreRepository, publicTransportRepository);
            var stopInTripService   = new StopInTripService(documentStoreRepository, publicTransportRepository);
            var busStopModelService = new BusStopModelService();

            var updateServiceHelper = new UpdateServiceHelper(joiner, grouper, timeService, tripService, busStopService,
                                                              busLineService, expeditionService, stopInTripService, busStopModelService, documentStoreRepository);

            documentStoreRepository.DeleteAllTimeTableJsons();
            await UpdateDataService.Init(timeService, updateServiceHelper);

            ConfigureServices(documentStoreRepository, publicTransportRepository);
        }
Esempio n. 17
0
        public void OpsOfCombinedGroupsMoveTo1stGroup()
        {
            var ops = new DeltaInsertOp[] {
                new DeltaInsertOp("this is code"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    CodeBlock = true
                }),
                new DeltaInsertOp("this is code TOO!"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    CodeBlock = true
                }),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    Blockquote = true
                }),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    Blockquote = true
                }),
                new DeltaInsertOp("\n"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    Header = 1
                }),
            };
            var pairs  = Grouper.PairOpsWithTheirBlock(ops);
            var groups = Grouper.GroupConsecutiveSameStyleBlocks(pairs);
            //console.log(groups);
            var act = Grouper.ReduceConsecutiveSameStyleBlocksToOne(groups);

            //console.log(act);
            //console.log(JSON.stringify(act));
            act.Should().BeEquivalentTo(new Group[] {
                new BlockGroup(ops[1],
                               new DeltaInsertOp[] { ops[0], ops[6], ops[2] }),
                new BlockGroup(ops[4],
                               new DeltaInsertOp[] { ops[6], ops[6] }),
                new InlineGroup(new DeltaInsertOp[] { ops[6] }),
                new BlockGroup(ops[7], new DeltaInsertOp[] { ops[6] })
            }, opts => opts.RespectingRuntimeTypes().WithStrictOrdering());
        }
Esempio n. 18
0
        public Grouper Create(Grouper item)
        {
            var connection = new Connection(Bancos.Sgq);

            if (item.name == null)
            {
                item.name = "";
            }

            if (item.executiveSummary == null)
            {
                item.executiveSummary = "";
            }

            bool resultado = false;

            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            using (SqlCommand command = new SqlCommand())
            {
                command.Connection  = connection.connection;
                command.CommandText = @"
                    insert into SGQ_Groupers
                        (name, type, executiveSummary) 
                    values 
                        (@name, @type, @executiveSummary)
                ";
                command.Parameters.AddWithValue("name", item.name);
                command.Parameters.AddWithValue("type", item.type);
                command.Parameters.AddWithValue("executiveSummary", item.executiveSummary);

                int i = command.ExecuteNonQuery();
                resultado = i > 0;
            }

            var createItem = this.getByName(item.name);

            connection.Dispose();
            return(createItem);
        }
Esempio n. 19
0
        public async Task <IActionResult> InvokeGrouper(bool ignoreChangelimit)
        {
            GrouperDocument document = await Helper.MakeDocumentAsync(Request);

            Grouper         grouper = GetGrouperBackend();
            GroupMemberDiff diff    = await grouper.GetMemberDiffAsync(document);

            // await grouper.UpdateGroupAsync(diff, ignoreChangelimit);
            var changes = new List <OperationalLogItem>();

            foreach (GroupMember member in diff.Add)
            {
                changes.Add(new OperationalLogItem(document, GroupMemberOperations.Add, member));
            }
            foreach (GroupMember member in diff.Remove)
            {
                changes.Add(new OperationalLogItem(document, GroupMemberOperations.Remove, member));
            }
            return(Ok(changes));
        }
Esempio n. 20
0
        public async Task MergeByAccountTest()
        {
            var     txDic   = GetTestData();
            Grouper grouper = new Grouper(new MockResourceUsageDetectionService());
            var     grouped = (await grouper.ProcessNaive(Hash.Generate(), txDic.Values.SelectMany(x => x).ToList())).Item1;
            var     s       = grouped.Select(
                x =>
                String.Join(" ", x.OrderBy(y => _accountList.IndexOf(y.From)).ThenBy(z => _accountList.IndexOf(z.To)).Select(
                                y => String.Format("({0}-{1})", _accountList.IndexOf(y.From), _accountList.IndexOf(y.To))
                                ))
                ).OrderBy(b => b).ToList();

            //group 1: {0-1}; {2-1, 2-4}; {3-2}; {4-5}
            Assert.Equal("(0-1) (2-1) (2-4) (3-2) (4-5)", s[0]);

            //group 2: {6-7}; {8-7}
            Assert.Equal("(6-7) (8-7)", s[1]);

            //group 3: {9-10}; {10-11}
            Assert.Equal("(9-10) (10-11)", s[2]);
        }
Esempio n. 21
0
        /// <summary>
        /// Run migrator.
        /// </summary>
        private static async Task <int> MigrateAsync(
            Filter filter,
            Grouper grouper,
            FileSystem fileSystem,
            Input input,
            Output output)
        {
            try
            {
                using (fileSystem)
                {
                    Logger.Debug("Using file system: {0}.", fileSystem);
                    await fileSystem.Open();

                    using (input)
                    {
                        Logger.Debug("Using input: {0}.", input);
                        await input.Open();

                        using (output)
                        {
                            Logger.Debug("Using output: {0}.", output);
                            await output.Open();

                            await new Migrator(input, output, filter, grouper).Migrate(CancellationTokenSource.Token);
                        }
                    }
                }
            }
            catch (OperationCanceledException)
            {
                Logger.Warn("Cancelled.");
                return(ExitCodes.Success);
            }
            // Finished.
            Logger.Info("Finished.");
            return(ExitCodes.Success);
        }
Esempio n. 22
0
        public void ShouldResolveGroupedData()
        {
            var allItems = BuildIntItems(1, 30);
            var items = BuildIntItems(1, 5);
            var dic = new Dictionary<int, string> { { 1, "true" }, { 0, "false" } };
            var grouper = new Grouper<int>(items, dic, x => x == 3 ? 1 : 0);
            var groupedData = grouper.ResolveGroupedData(allItems);
            Assert.AreEqual(2, groupedData.Count());
            var trueData = groupedData.Where(x => x.Description == "true").Single();
            var falseData = groupedData.Where(x => x.Description == "false").Single();

            Assert.AreEqual( "true" , trueData.Description);
            Assert.AreEqual(20, trueData.PercentageOf);
            Assert.AreEqual(1, trueData.GroupCount);
            Assert.AreEqual(5, trueData.AllGroupsCount);
            Assert.AreEqual(30, trueData.GlobalCount);

            Assert.AreEqual("false", falseData.Description);
            Assert.AreEqual(80, falseData.PercentageOf);
            Assert.AreEqual(4, falseData.GroupCount);
            Assert.AreEqual(5, falseData.AllGroupsCount);
            Assert.AreEqual(30, falseData.GlobalCount);
        }
Esempio n. 23
0
 public IEnumerable<GroupData> ByFetchDataFromWatchWeight(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary,
                                                     x => x.FetchDataFromWatchWeight);
     return grouper.ResolveGroupedData(AllRespondents);
 }
 public GroupCalculator(Grouper grouper, ISimpleInterestCalculator simpleInterestCalculator)
 {
     Grouper = grouper;
     SimpleInterestCalculator = simpleInterestCalculator;
 }
Esempio n. 25
0
 public IEnumerable<GroupData> ByGoal(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _goalDictionary, x => x.Goal);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 26
0
 public void SetGroupBoxStyle(Grouper ts)
 {
     this.groupBox1.CloneGrouperStyle(ts);
 }
 // Modifies grouper box to indicate conditions are NOT met
 private void conditionIsNotMet(Grouper group)
 {
     group.BorderColor = System.Drawing.Color.Black;
 }
Esempio n. 28
0
 public IEnumerable<GroupData> ByNumberOfYearsRunning(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _numberOfYearsDictionary,
                                                     x => x.NumberOfYearsRunning);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 29
0
 public IEnumerable<GroupData> ByMonthlyPayment(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _monthlyPaymentDictionary,
                                                     x => x.MonthlyPayment);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 30
0
            public void Test(
                string inputFileSettings,
                string groupsFile,
                int bufferSize,
                int enginesCount,
                int maxThreadsCount,
                bool clear)
            {
                string inputFilePath = null;

                try
                {
                    if (inputFileSettings.StartsWith(UseExistanceFile))
                    {
                        inputFilePath = SplitString(inputFileSettings, ": ")[1];
                    }
                    else
                    {
                        var fileGenerationSettings = SplitString(inputFileSettings, " ");
                        Generator.Generate(sizeData: fileGenerationSettings[0],
                                           lineSettings: fileGenerationSettings[1],
                                           path: fileGenerationSettings[2]);
                        inputFilePath = fileGenerationSettings[2];
                    }

                    var configMock           = new Mock <IConfig>();
                    var physicalBufferLength = bufferSize + 1;

                    configMock
                    .SetupGet(o => o.PhysicalBufferLength)
                    .Returns(physicalBufferLength);

                    configMock
                    .SetupGet(o => o.UsingBufferLength)
                    .Returns(bufferSize);

                    configMock
                    .SetupGet(o => o.MaxRunningTasksCount)
                    .Returns(maxThreadsCount);

                    configMock
                    .SetupGet(o => o.GrouperEnginesCount)
                    .Returns(enginesCount);

                    configMock
                    .SetupGet(o => o.InputFilePath)
                    .Returns(inputFilePath);

                    configMock
                    .SetupGet(o => o.GroupsFilePath)
                    .Returns(groupsFile);

                    IGroupsInfoMarger groupsSummaryInfoMarger =
                        new GroupsInfoMarger();

                    ITasksQueue tasksQueue =
                        new TasksQueue(configMock.Object);

                    IBuffersPool buffersPool =
                        new InfinityBuffersPool(physicalBufferLength);

                    IIoService ioService =
                        new IoService(
                            buffersPool);

                    IInputReaderFactory inputReaderMaker =
                        new InputReaderFactory(
                            ioService,
                            tasksQueue,
                            buffersPool,
                            configMock.Object);

                    IGroupsLinesOutputFactory linesWriterFactory =
                        new GroupsLinesOutputFactory(
                            ioService,
                            tasksQueue,
                            buffersPool,
                            configMock.Object);

                    IGrouperIOs grouperIOs =
                        new GrouperIOs(
                            inputReaderMaker,
                            linesWriterFactory,
                            ioService,
                            configMock.Object);

                    ILinesIndexesExtractor linesIndexesExtractor =
                        new LinesIndexesExtractor(
                            configMock.Object);

                    IGroupsLoaderFactory groupsLoaderMaker =
                        new GroupsLoaderFactory(
                            buffersPool,
                            ioService,
                            configMock.Object);

                    var grouper = new Grouper(
                        groupsSummaryInfoMarger,
                        grouperIOs,
                        tasksQueue,
                        configMock.Object);

                    var trivialGrouper = new TrivialGrouper();
                    var expectedGroups = trivialGrouper.SplitToGroups(
                        ReadAllLinesFrom(inputFilePath));

                    var groupsInfo = grouper.SeparateInputToGroups();

                    var output = new IGroup[Consts.MaxGroupsCount];
                    var loader = groupsLoaderMaker.Create(groupsInfo, output);
                    loader.LoadNextGroups();

                    var expectedGroupIds = expectedGroups
                                           .Select(o => o.Id)
                                           .ToArray();

                    var actualGroupIds = groupsInfo
                                         .Select((group, id) => new { group, id })
                                         .Where(o => !GroupInfo.IsZero(o.group))
                                         .Select(o => o.id)
                                         .ToArray();
                    #region DEBUG
// #if DEBUG
//                     var expectedGroupPrefixes = expectedGroupIds
//                         .Select(ToPrefix)
//                         .ToArray();
//
//                     var actualGroupPrefixes = actualGroupIds
//                         .Select(ToPrefix)
//                         .ToArray();
//
//                     var expectedGroupPrefixesInLine =
//                         string.Join(" | ", expectedGroupPrefixes);
//
//                     var actualGroupPrefixesInLine =
//                         string.Join(" | ", actualGroupPrefixes);
//
//                     var actualIdsOnly = actualGroupIds
//                         .Except(expectedGroupIds)
//                         .Select(ToPrefix);
//
//                     var actualIdsOnlyInLine =
//                         string.Join(" | ", actualIdsOnly);
//
//                     var expectedIdsOnly = expectedGroupIds
//                         .Except(actualGroupIds)
//                         .Select(ToPrefix);
//
//                     var allPrefixes =
//                         new[]
//                         {
//                             new[] {string.Empty},
//
//                             Enumerable.Range(' ', '~' - ' ' + 1)
//                                       .Select(o => ((char) o).ToString()),
//
//                             Enumerable.Join(
//                                 Enumerable.Range(' ', '~' - ' ' + 1),
//                                 Enumerable.Range(' ', '~' - ' ' + 1),
//                                 _ => true,
//                                 _ => true,
//                                 (c1, c2) => new string(new []{(char)c1, (char)c2}))
//                         }
//                         .Aggregate(Enumerable.Concat)
//                         .ToArray();
//
//                     var allCalculatedIds = allPrefixes
//                         .Select(ToId)
//                         .OrderBy(o => o)
//                         .ToArray();
//
//                     var allCalculatedIdsDistinct =
//                         allCalculatedIds.Distinct().ToArray();
//
//                     var allCalculatedPrefixes = Enumerable
//                         .Range(0, Consts.MaxGroupsCount)
//                         .Select(ToPrefix)
//                         .ToArray();
//
//                     var allCalculatedPrefixesDistinct =
//                         allCalculatedPrefixes.Distinct().ToArray();
// #endif
                    #endregion
                    CollectionAssert.AreEqual(
                        expectedGroupIds,
                        actualGroupIds);

                    int j = 0;
                    for (int i = 0; i < Consts.MaxGroupsCount; i++)
                    {
                        var info = groupsInfo[i];
                        if (GroupInfo.IsZero(info))
                        {
                            continue;
                        }

                        var expectedInfo = expectedGroups[j];
                        Assert.AreEqual(expectedInfo.BytesCount, info.BytesCount);
                        Assert.AreEqual(expectedInfo.LinesCount, info.LinesCount);

                        linesIndexesExtractor.ExtractIndexes(output[i]);

                        var expectedLines = expectedInfo.Lines
                                            .Select(o => o.Content)
                                            .ToArray();

                        foreach (var line in expectedLines)
                        {
                            line[0] = Consts.EndLineByte1;
                        }

                        var expectedLinesDictionary =
                            new Dictionary <HashedBytesArray, int>(info.LinesCount);

                        for (int k = 0; k < info.LinesCount; k++)
                        {
                            var hashedLine = Hash(expectedLines[k]);
                            if (expectedLinesDictionary.ContainsKey(hashedLine))
                            {
                                ++expectedLinesDictionary[hashedLine];
                            }
                            else
                            {
                                expectedLinesDictionary.Add(hashedLine, 1);
                            }
                        }
                        #region DEBUG
// #if DEBUG
//                         var linesCountInDictionary = expectedLinesDictionary
//                             .Values.Sum(o => o);
// #endif
                        #endregion
                        var lines = output[i].Lines;
                        for (int k = 0; k < info.LinesCount; k++)
                        {
                            var lineIndexes = lines.Array[lines.Offset + k];
                            var lineLength  = lineIndexes.LettersCount
                                              + lineIndexes.DigitsCount
                                              + 3;

                            var buffers       = output[i].Buffers;
                            var bufferIndex   = lineIndexes.Start / bufferSize;
                            var indexInBuffer = lineIndexes.Start % bufferSize;
                            var line          = new byte[lineLength];

                            if (indexInBuffer + lineLength <= bufferSize)
                            {
                                Array.Copy(buffers.Array[buffers.Offset + bufferIndex], indexInBuffer,
                                           line, 0,
                                           lineLength);
                            }
                            else
                            {
                                var bufferRightLength = bufferSize - indexInBuffer;
                                Array.Copy(buffers.Array[buffers.Offset + bufferIndex], indexInBuffer,
                                           line, 0,
                                           bufferRightLength);

                                Array.Copy(buffers.Array[buffers.Offset + bufferIndex + 1], 0,
                                           line, bufferRightLength,
                                           lineLength - bufferRightLength);
                            }

                            var actualHashedLine = Hash(line);
                            Assert.IsTrue(expectedLinesDictionary.ContainsKey(actualHashedLine));
                            --expectedLinesDictionary[actualHashedLine];
                            if (expectedLinesDictionary[actualHashedLine] == 0)
                            {
                                expectedLinesDictionary.Remove(actualHashedLine);
                            }
                        }

                        Assert.AreEqual(0, expectedLinesDictionary.Count);
                        ++j;
                    }

                    Assert.AreEqual(expectedGroups.Length, j);
                    loader.Dispose();
                }
                finally
                {
                    if (clear)
                    {
                        if (!inputFileSettings.StartsWith(UseExistanceFile) &&
                            inputFilePath != null &&
                            File.Exists(inputFilePath))
                        {
                            File.Delete(inputFilePath);
                        }

                        if (File.Exists(groupsFile))
                        {
                            File.Delete(groupsFile);
                        }
                    }
                }
            }
Esempio n. 31
0
 private Grouper GetGrouperBackend()
 {
     return(Grouper.CreateFromConfig(_config));
 }
Esempio n. 32
0
        public IDisposable Subscribe(IObserver <IGroupedObservable <TKey, TSource> > observer)
        {
            var grouper = new Grouper(observer, this.keySelector);

            return(source.Subscribe(grouper));
        }
Esempio n. 33
0
 public IEnumerable<GroupData> ByStatisticsBestRunsWeight(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary,
                                                     x => x.StatisticsBestRunsWeight);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 34
0
 public IEnumerable<GroupData> ByRegisterShoeDataWeight(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary,
                                                     x => x.RegisterShoeDataWeight);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 35
0
 public IEnumerable<GroupData> ByCompareResultsWithOthersWeight(
     IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary,
                                                     x => x.CompareResultsWithOthersWeight);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 36
0
 public IEnumerable<GroupData> ByAge(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _ageDictionary, x => x.Age);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 37
0
 public IEnumerable<GroupData> ByInterestInAnyTrainingTool(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _trainingToolInterestDictionary,
                                                     x => _hasInterestCollectingTrainingData(x) ? 1 : 0);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 38
0
 /// <summary>
 /// Add grouper to chain.
 /// </summary>
 public void AddGrouper(Grouper innerGrouper)
 {
     innerGroupers.Add(innerGrouper);
 }
Esempio n. 39
0
 public IEnumerable<GroupData> ByNumberOfRunsPerWeek(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _numberOfRunsPerWeekDictionary,
                                                     x => x.NumberOfRunsPerWeek);
     return grouper.ResolveGroupedData(AllRespondents);
 }
Esempio n. 40
0
 public IEnumerable<Group<Respondent>> GroupByGoal(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _goalDictionary,
                                                     x => x.Goal);
     return grouper.GetGroups().OrderBy(x => x.ID);
 }
Esempio n. 41
0
 public IEnumerable<Group<Respondent>> GroupByMonthlyPayment(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _monthlyPaymentDictionary,
                                                     x => x.MonthlyPayment);
     return grouper.GetGroups().OrderBy(x => x.ID);
 }
Esempio n. 42
0
 public void SetGroupBoxStyle(Grouper ts)
 {
     this.GrouperTitleStyle = ts;
     this.spotColorMaskSetting1.GrouperTitleStyle = ts;
     this.spotColorMaskSetting2.GrouperTitleStyle = ts;
 }
Esempio n. 43
0
 public IEnumerable<Group<Respondent>> GroupByNumberOfYearsRunning(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _numberOfYearsDictionary,
                                                     x => x.NumberOfYearsRunning);
     return grouper.GetGroups().OrderBy(x => x.ID);
 }
Esempio n. 44
0
        public void Test(
            [ValueSource(nameof(Cases))] TestCase testCase,
            [ValueSource(nameof(BufferSizes))] BufferSize bufferSize,
            [ValueSource(nameof(EnginesCount))] int enginesCount,
            [ValueSource(nameof(MaxThreadsCount))] int maxThreadsCount)
        {
            const string inputPath = "ZZZZZzzzzZzZZzzzZZZzzz",
           groupsPath = "WWwwwWWwwwWWWwwwwwwwww";

            var groupsFileLength = testCase.Lines
                                   .Sum(o => o.Length + Consts.EndLineBytesCount);

            byte[] groupsFileContent = new byte[groupsFileLength];
            var    inputSource       = testCase.Lines
                                       .SelectMany(line => new[] { line.Select(c => (byte)c), Consts.EndLineBytes })
                                       .Aggregate(Enumerable.Concat)
                                       .ToArray();

            var ioServiceMock = new Mock <IIoService>();
            var configMock    = new Mock <IConfig>();

            ioServiceMock
            .Setup(o => o.SizeOfFile(inputPath))
            .Returns(groupsFileLength);

            ioServiceMock
            .Setup(o => o.OpenRead(inputPath, It.IsAny <long>()))
            .Returns((string _, long position) =>
            {
                var inputStream     = new MemoryStream(inputSource);
                var inputReaderMock = new Mock <IFileReader>();
                inputReaderMock
                .SetupGet(o => o.Length)
                .Returns(() => inputStream.Length);

                inputReaderMock
                .SetupGet(o => o.Position)
                .Returns(() => inputStream.Position);

                inputReaderMock
                .SetupSet(o => o.Position = It.IsAny <long>())
                .Callback((long value) => inputStream.Position = value);

                inputReaderMock
                .Setup(o => o.ReadByte())
                .Returns(() => inputStream.ReadByte());

                inputReaderMock
                .Setup(o => o.Read(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()))
                .Returns((byte[] buff, int offset, int count) =>
                         inputStream.Read(buff, offset, count));

                inputReaderMock
                .Setup(o => o.Dispose())
                .Callback(() => inputStream.Dispose());

                inputReaderMock.Object.Position = position;
                return(inputReaderMock.Object);
            });

            ioServiceMock
            .Setup(o => o.OpenWrite(groupsPath, It.IsAny <long>(), false))
            .Returns((string _, long position, bool __) =>
            {
                var groupsStream = new MemoryStream(groupsFileContent);
                var writerMock   = new Mock <IFileWriter>();

                writerMock
                .SetupGet(o => o.Position)
                .Returns(() => groupsStream.Position);

                writerMock
                .SetupSet(o => o.Position = It.IsAny <long>())
                .Callback((long value) => groupsStream.Position = value);

                writerMock
                .SetupGet(o => o.Length)
                .Returns(() => groupsStream.Length);

                writerMock
                .Setup(o => o.Write(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()))
                .Callback((byte[] buff, int offset, int count) =>
                          groupsStream.Write(buff, offset, count));

                writerMock
                .Setup(o => o.Dispose())
                .Callback(() => groupsStream.Close());

                return(writerMock.Object);
            });

            var maxLineLength = testCase.Lines
                                .Max(line => line.Length + Consts.EndLineBytesCount);

            int buffSize = new Dictionary <BufferSize, int>
            {
                { BufferSize.Min, maxLineLength + 1 },
                { BufferSize.Small, maxLineLength + 2 },
                { BufferSize.Medium, groupsFileLength + 1 },
                { BufferSize.Large, groupsFileLength * 2 }
            }[bufferSize];

            configMock
            .SetupGet(o => o.PhysicalBufferLength)
            .Returns(buffSize + sizeof(ulong));

            configMock
            .SetupGet(o => o.UsingBufferLength)
            .Returns(buffSize);

            configMock
            .SetupGet(o => o.MaxRunningTasksCount)
            .Returns(maxThreadsCount);

            configMock
            .SetupGet(o => o.GrouperEnginesCount)
            .Returns(enginesCount);

            configMock
            .SetupGet(o => o.InputFilePath)
            .Returns(inputPath);

            configMock
            .SetupGet(o => o.GroupsFilePath)
            .Returns(groupsPath);

            IGroupsInfoMarger groupsSummaryInfoMarger =
                new GroupsInfoMarger();

            ITasksQueue tasksQueue =
                new TasksQueue(configMock.Object);

            IBuffersPool buffersPool =
                new BuffersPool(configMock.Object);

            IInputReaderFactory inputReaderMaker =
                new InputReaderFactory(
                    ioServiceMock.Object,
                    tasksQueue,
                    buffersPool,
                    configMock.Object);

            IGroupsLinesOutputFactory linesWriterFactory =
                new GroupsLinesOutputFactory(
                    ioServiceMock.Object,
                    tasksQueue,
                    buffersPool,
                    configMock.Object);

            IGrouperIOs grouperIOs =
                new GrouperIOs(
                    inputReaderMaker,
                    linesWriterFactory,
                    ioServiceMock.Object,
                    configMock.Object);

            var grouper = new Grouper(
                groupsSummaryInfoMarger,
                grouperIOs,
                tasksQueue,
                configMock.Object);

            var trivialGrouper = new TrivialGrouper();
            var expectedGroups = trivialGrouper
                                 .SplitToGroups(testCase.Lines);

            var groupsInfo   = grouper.SeparateInputToGroups();
            var resultGroups = ExtractGroups(groupsInfo, groupsFileContent);

            Assert.IsTrue(resultGroups.Select(Group.IsValid).All(o => o));
            CollectionAssert.AreEqual(
                expectedGroups,
                resultGroups);
        }
Esempio n. 45
0
 public IEnumerable<Group<Respondent>> GroupByTrainerWeight(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary, x => x.TrainerWeight);
     return grouper.GetGroups().OrderBy(x=>x.ID);
 }
Esempio n. 46
0
 public IEnumerable<GroupData> ByUseOfAnyTrainingTool(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _trainingToolDictionary,
                                                     x => _usesTrainingToolPredicate(x) ? 1 : 0);
     return grouper.ResolveGroupedData(AllRespondents);
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectForm));
     this.btnOk = new System.Windows.Forms.Button();
     this.btnCancel = new System.Windows.Forms.Button();
     this.grouperServiceBusNamespaceSettings = new Microsoft.AppFabric.CAT.WindowsAzure.Samples.ServiceBusExplorer.Grouper();
     this.txtUri = new System.Windows.Forms.TextBox();
     this.lblUri = new System.Windows.Forms.Label();
     this.txtServicePath = new System.Windows.Forms.TextBox();
     this.lblPath = new System.Windows.Forms.Label();
     this.txtIssuerSecret = new System.Windows.Forms.TextBox();
     this.lblIssuerSecret = new System.Windows.Forms.Label();
     this.txtIssuerName = new System.Windows.Forms.TextBox();
     this.lblIssuerName = new System.Windows.Forms.Label();
     this.txtNamespace = new System.Windows.Forms.TextBox();
     this.lblNamespace = new System.Windows.Forms.Label();
     this.grouperServiceBusNamespaces = new Microsoft.AppFabric.CAT.WindowsAzure.Samples.ServiceBusExplorer.Grouper();
     this.cboServiceBusNamespace = new System.Windows.Forms.ComboBox();
     this.grouperServiceBusNamespaceSettings.SuspendLayout();
     this.grouperServiceBusNamespaces.SuspendLayout();
     this.SuspendLayout();
     //
     // btnOk
     //
     this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
     this.btnOk.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnOk.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnOk.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.btnOk.Location = new System.Drawing.Point(232, 388);
     this.btnOk.Name = "btnOk";
     this.btnOk.Size = new System.Drawing.Size(72, 24);
     this.btnOk.TabIndex = 0;
     this.btnOk.Text = "OK";
     this.btnOk.UseVisualStyleBackColor = false;
     this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
     this.btnOk.MouseEnter += new System.EventHandler(this.button_MouseEnter);
     this.btnOk.MouseLeave += new System.EventHandler(this.button_MouseLeave);
     //
     // btnCancel
     //
     this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
     this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnCancel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.btnCancel.Location = new System.Drawing.Point(312, 388);
     this.btnCancel.Name = "btnCancel";
     this.btnCancel.Size = new System.Drawing.Size(72, 24);
     this.btnCancel.TabIndex = 1;
     this.btnCancel.Text = "Cancel";
     this.btnCancel.UseVisualStyleBackColor = false;
     this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
     this.btnCancel.MouseEnter += new System.EventHandler(this.button_MouseEnter);
     this.btnCancel.MouseLeave += new System.EventHandler(this.button_MouseLeave);
     //
     // grouperServiceBusNamespaceSettings
     //
     this.grouperServiceBusNamespaceSettings.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
     this.grouperServiceBusNamespaceSettings.BackgroundGradientColor = System.Drawing.Color.White;
     this.grouperServiceBusNamespaceSettings.BackgroundGradientMode = Microsoft.AppFabric.CAT.WindowsAzure.Samples.ServiceBusExplorer.Grouper.GroupBoxGradientMode.None;
     this.grouperServiceBusNamespaceSettings.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.grouperServiceBusNamespaceSettings.BorderThickness = 1F;
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.txtUri);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.lblUri);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.txtServicePath);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.lblPath);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.txtIssuerSecret);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.lblIssuerSecret);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.txtIssuerName);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.lblIssuerName);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.txtNamespace);
     this.grouperServiceBusNamespaceSettings.Controls.Add(this.lblNamespace);
     this.grouperServiceBusNamespaceSettings.CustomGroupBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.grouperServiceBusNamespaceSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
     this.grouperServiceBusNamespaceSettings.ForeColor = System.Drawing.Color.White;
     this.grouperServiceBusNamespaceSettings.GroupImage = null;
     this.grouperServiceBusNamespaceSettings.GroupTitle = "Connection Settings";
     this.grouperServiceBusNamespaceSettings.Location = new System.Drawing.Point(16, 96);
     this.grouperServiceBusNamespaceSettings.Name = "grouperServiceBusNamespaceSettings";
     this.grouperServiceBusNamespaceSettings.Padding = new System.Windows.Forms.Padding(20);
     this.grouperServiceBusNamespaceSettings.PaintGroupBox = true;
     this.grouperServiceBusNamespaceSettings.RoundCorners = 4;
     this.grouperServiceBusNamespaceSettings.ShadowColor = System.Drawing.Color.DarkGray;
     this.grouperServiceBusNamespaceSettings.ShadowControl = false;
     this.grouperServiceBusNamespaceSettings.ShadowThickness = 1;
     this.grouperServiceBusNamespaceSettings.Size = new System.Drawing.Size(368, 280);
     this.grouperServiceBusNamespaceSettings.TabIndex = 33;
     //
     // txtUri
     //
     this.txtUri.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.txtUri.ForeColor = System.Drawing.SystemColors.ControlText;
     this.txtUri.Location = new System.Drawing.Point(16, 48);
     this.txtUri.Name = "txtUri";
     this.txtUri.Size = new System.Drawing.Size(336, 20);
     this.txtUri.TabIndex = 0;
     this.txtUri.TextChanged += new System.EventHandler(this.validation_TextChanged);
     //
     // lblUri
     //
     this.lblUri.AutoSize = true;
     this.lblUri.ForeColor = System.Drawing.SystemColors.ControlText;
     this.lblUri.Location = new System.Drawing.Point(16, 32);
     this.lblUri.Name = "lblUri";
     this.lblUri.Size = new System.Drawing.Size(108, 13);
     this.lblUri.TabIndex = 43;
     this.lblUri.Text = "URI or Server FQDN:";
     //
     // txtServicePath
     //
     this.txtServicePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.txtServicePath.ForeColor = System.Drawing.SystemColors.ControlText;
     this.txtServicePath.Location = new System.Drawing.Point(16, 144);
     this.txtServicePath.Name = "txtServicePath";
     this.txtServicePath.Size = new System.Drawing.Size(336, 20);
     this.txtServicePath.TabIndex = 2;
     this.txtServicePath.Text = "Path";
     this.txtServicePath.TextChanged += new System.EventHandler(this.validation_TextChanged);
     //
     // lblPath
     //
     this.lblPath.AutoSize = true;
     this.lblPath.ForeColor = System.Drawing.SystemColors.ControlText;
     this.lblPath.Location = new System.Drawing.Point(16, 128);
     this.lblPath.Name = "lblPath";
     this.lblPath.Size = new System.Drawing.Size(32, 13);
     this.lblPath.TabIndex = 41;
     this.lblPath.Text = "Path:";
     //
     // txtIssuerSecret
     //
     this.txtIssuerSecret.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.txtIssuerSecret.ForeColor = System.Drawing.SystemColors.ControlText;
     this.txtIssuerSecret.Location = new System.Drawing.Point(16, 240);
     this.txtIssuerSecret.Name = "txtIssuerSecret";
     this.txtIssuerSecret.PasswordChar = '*';
     this.txtIssuerSecret.Size = new System.Drawing.Size(336, 20);
     this.txtIssuerSecret.TabIndex = 4;
     this.txtIssuerSecret.Text = "None";
     this.txtIssuerSecret.TextChanged += new System.EventHandler(this.validation_TextChanged);
     //
     // lblIssuerSecret
     //
     this.lblIssuerSecret.AutoSize = true;
     this.lblIssuerSecret.ForeColor = System.Drawing.SystemColors.ControlText;
     this.lblIssuerSecret.Location = new System.Drawing.Point(16, 224);
     this.lblIssuerSecret.Name = "lblIssuerSecret";
     this.lblIssuerSecret.Size = new System.Drawing.Size(72, 13);
     this.lblIssuerSecret.TabIndex = 40;
     this.lblIssuerSecret.Text = "Issuer Secret:";
     //
     // txtIssuerName
     //
     this.txtIssuerName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.txtIssuerName.ForeColor = System.Drawing.SystemColors.ControlText;
     this.txtIssuerName.Location = new System.Drawing.Point(16, 192);
     this.txtIssuerName.Name = "txtIssuerName";
     this.txtIssuerName.Size = new System.Drawing.Size(336, 20);
     this.txtIssuerName.TabIndex = 3;
     this.txtIssuerName.Text = "None";
     this.txtIssuerName.TextChanged += new System.EventHandler(this.validation_TextChanged);
     //
     // lblIssuerName
     //
     this.lblIssuerName.AutoSize = true;
     this.lblIssuerName.ForeColor = System.Drawing.SystemColors.ControlText;
     this.lblIssuerName.Location = new System.Drawing.Point(16, 176);
     this.lblIssuerName.Name = "lblIssuerName";
     this.lblIssuerName.Size = new System.Drawing.Size(69, 13);
     this.lblIssuerName.TabIndex = 39;
     this.lblIssuerName.Text = "Issuer Name:";
     //
     // txtNamespace
     //
     this.txtNamespace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.txtNamespace.ForeColor = System.Drawing.SystemColors.ControlText;
     this.txtNamespace.Location = new System.Drawing.Point(16, 96);
     this.txtNamespace.Name = "txtNamespace";
     this.txtNamespace.Size = new System.Drawing.Size(336, 20);
     this.txtNamespace.TabIndex = 1;
     this.txtNamespace.Text = "ServiceBusDefaultNamespace";
     this.txtNamespace.TextChanged += new System.EventHandler(this.validation_TextChanged);
     //
     // lblNamespace
     //
     this.lblNamespace.AutoSize = true;
     this.lblNamespace.ForeColor = System.Drawing.SystemColors.ControlText;
     this.lblNamespace.Location = new System.Drawing.Point(16, 80);
     this.lblNamespace.Name = "lblNamespace";
     this.lblNamespace.Size = new System.Drawing.Size(67, 13);
     this.lblNamespace.TabIndex = 38;
     this.lblNamespace.Text = "Namespace:";
     //
     // grouperServiceBusNamespaces
     //
     this.grouperServiceBusNamespaces.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
     this.grouperServiceBusNamespaces.BackgroundGradientColor = System.Drawing.Color.White;
     this.grouperServiceBusNamespaces.BackgroundGradientMode = Microsoft.AppFabric.CAT.WindowsAzure.Samples.ServiceBusExplorer.Grouper.GroupBoxGradientMode.None;
     this.grouperServiceBusNamespaces.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.grouperServiceBusNamespaces.BorderThickness = 1F;
     this.grouperServiceBusNamespaces.Controls.Add(this.cboServiceBusNamespace);
     this.grouperServiceBusNamespaces.CustomGroupBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(180)))), ((int)(((byte)(209)))));
     this.grouperServiceBusNamespaces.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
     this.grouperServiceBusNamespaces.ForeColor = System.Drawing.Color.White;
     this.grouperServiceBusNamespaces.GroupImage = null;
     this.grouperServiceBusNamespaces.GroupTitle = "Service Bus Namespaces";
     this.grouperServiceBusNamespaces.Location = new System.Drawing.Point(16, 8);
     this.grouperServiceBusNamespaces.Name = "grouperServiceBusNamespaces";
     this.grouperServiceBusNamespaces.Padding = new System.Windows.Forms.Padding(20);
     this.grouperServiceBusNamespaces.PaintGroupBox = true;
     this.grouperServiceBusNamespaces.RoundCorners = 4;
     this.grouperServiceBusNamespaces.ShadowColor = System.Drawing.Color.DarkGray;
     this.grouperServiceBusNamespaces.ShadowControl = false;
     this.grouperServiceBusNamespaces.ShadowThickness = 1;
     this.grouperServiceBusNamespaces.Size = new System.Drawing.Size(368, 72);
     this.grouperServiceBusNamespaces.TabIndex = 32;
     //
     // cboServiceBusNamespace
     //
     this.cboServiceBusNamespace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     | System.Windows.Forms.AnchorStyles.Right)));
     this.cboServiceBusNamespace.BackColor = System.Drawing.SystemColors.Window;
     this.cboServiceBusNamespace.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.cboServiceBusNamespace.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.cboServiceBusNamespace.FormattingEnabled = true;
     this.cboServiceBusNamespace.Location = new System.Drawing.Point(16, 32);
     this.cboServiceBusNamespace.Name = "cboServiceBusNamespace";
     this.cboServiceBusNamespace.Size = new System.Drawing.Size(336, 21);
     this.cboServiceBusNamespace.TabIndex = 0;
     this.cboServiceBusNamespace.SelectedIndexChanged += new System.EventHandler(this.cboServiceBusNamespace_SelectedIndexChanged);
     //
     // ConnectForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
     this.ClientSize = new System.Drawing.Size(402, 425);
     this.Controls.Add(this.grouperServiceBusNamespaceSettings);
     this.Controls.Add(this.grouperServiceBusNamespaces);
     this.Controls.Add(this.btnOk);
     this.Controls.Add(this.btnCancel);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.KeyPreview = true;
     this.MaximizeBox = false;
     this.MinimizeBox = false;
     this.Name = "ConnectForm";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text = "Connect to a Service Bus Namespace";
     this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ConnectForm_KeyPress);
     this.grouperServiceBusNamespaceSettings.ResumeLayout(false);
     this.grouperServiceBusNamespaceSettings.PerformLayout();
     this.grouperServiceBusNamespaces.ResumeLayout(false);
     this.ResumeLayout(false);
 }
Esempio n. 48
0
        public void NestsIfListsAreSameAndLaterOnesHaveHigherIndent()
        {
            var ops = new DeltaInsertOp[] {
                new DeltaInsertOp("item 1"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered
                }),
                new DeltaInsertOp("item 1a"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered, Indent = 1
                }),
                new DeltaInsertOp("item 1a-i"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered, Indent = 3
                }),
                new DeltaInsertOp("item 1b"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered, Indent = 1
                }),
                new DeltaInsertOp("item 2"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered
                }),
                new DeltaInsertOp("haha"),
                new DeltaInsertOp("\n"),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Ordered, Indent = 5
                }),
                new DeltaInsertOp("\n",
                                  new OpAttributes {
                    List = ListType.Bullet, Indent = 4
                }),
            };
            var pairs = Grouper.PairOpsWithTheirBlock(ops);
            var act   = ListNester.Nest(pairs);
            //console.log(JSON.stringify( act, null, 4));


            var l1b = new ListItem((BlockGroup)pairs[3]);
            var lai = new ListGroup(new ListItem[] {
                new ListItem((BlockGroup)pairs[2])
            });
            var l1a = new ListGroup(new ListItem[] {
                new ListItem((BlockGroup)pairs[1], lai)
            });
            var li1 = new ListGroup(new ListItem[] {
                new ListItem((BlockGroup)pairs[0])
            });

            li1.Items[0].InnerList = new ListGroup(
                l1a.Items.Concat(Enumerable.Repeat(l1b, 1)).ToArray());
            var li2 = new ListGroup(new ListItem[] {
                new ListItem((BlockGroup)pairs[4])
            });

            //console.log(JSON.stringify(act, null, 3));
            act.Should().BeEquivalentTo(new Group[] {
                new ListGroup(li1.Items.Concat(li2.Items).ToArray()),
                new InlineGroup(new DeltaInsertOp[] { ops[10], ops[11] }),
                new ListGroup(new ListItem[] {
                    new ListItem(new BlockGroup(ops[12], new DeltaInsertOp [] { }))
                }),
                new ListGroup(new ListItem[] {
                    new ListItem(new BlockGroup(ops[13], new DeltaInsertOp [] { }))
                })
            }, opts => opts.RespectingRuntimeTypes()
                                        .WithStrictOrdering()
                                        .AllowingInfiniteRecursion());
        }
Esempio n. 49
0
 public IEnumerable<GroupData> ByVisualWeightlossWeight(IEnumerable<Respondent> respondents)
 {
     var grouper = new Grouper<Respondent>(respondents, _weightedAnswerDictionary,
                                                     x => x.VisualWeightlossWeight);
     return grouper.ResolveGroupedData(AllRespondents);
 }