public void LoadJson_ValidData() { string jsonFilePath = Path.Combine(Environment.CurrentDirectory, @"Data", @"IntersectionFinder", @"valid.json"); IntersectionFinder intersectionFinderObject = IntersectionFinder.LoadJson(jsonFilePath); Assert.NotNull(intersectionFinderObject); }
public void LoadJson_SingleItem() { string jsonFilePath = Path.Combine(Environment.CurrentDirectory, @"Data", @"IntersectionFinder", @"single_item.json"); IntersectionFinder intersectionFinderObject = IntersectionFinder.LoadJson(jsonFilePath); Assert.Null(intersectionFinderObject); }
internal override void Paint(PointFeature point) { ISpatialDisplay display = ActiveDisplay; IDrawStyle style = Controller.DrawStyle; style.FillColor = style.LineColor = Color.Magenta; if (m_CurrentPoint != null) { style.Render(display, m_CurrentPoint); } if (m_Start != null && m_End != null) { RenderGeometry(display, style); EditingController ec = EditingController.Current; if (ec.Project.Settings.AreIntersectionsDrawn && ArePointsDrawn() && AddingTopology()) { // The intersect geometry could be null when starting to add a new // circular arc LineGeometry line = GetIntersectGeometry(); if (line != null) { IntersectionFinder xf = new IntersectionFinder(line, false); style.FillColor = Color.Transparent; xf.Render(display, style); } } } }
static void Main() { IConfigurationBuilder builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddEnvironmentVariables(); IConfigurationRoot configuration = builder.Build(); AppSettings appSettings = new AppSettings(); configuration.GetSection("MyConfig").Bind(appSettings); IOptions <AppSettings> options = Options.Create <AppSettings>(appSettings); IEntryRepository entryRepository = new EntryRepository(options); List <EntryModel> sortedList = entryRepository.LoadEntries(); ConsoleUI consoleUI = new ConsoleUI(); DateTime[] dates = consoleUI.Initialize(); IIntersectionFinder intersectionFinder = new IntersectionFinder(sortedList); //returns null if no entries intersect int[] intersectedIndexes = intersectionFinder.FindEntries(dates[0], dates[1]); if (intersectedIndexes != null) { IAnagramValidator anagramValidator = new AnagramValidator(sortedList); List <int> anagramsIndexes = anagramValidator.Validate(intersectedIndexes[0], intersectedIndexes[1]); IPalindromeRepository palindromeRepository = new PalindromeRepository(options, sortedList); palindromeRepository.WriteEntries(anagramsIndexes); } }
public void LoadJson_NullAndNegativeValuesShouldContainsFive() { string jsonFilePath = Path.Combine(Environment.CurrentDirectory, @"Data", @"IntersectionFinder", @"null_and_negative.json"); IntersectionFinder intersectionFinderObject = IntersectionFinder.LoadJson(jsonFilePath); int expected = 5; int actual = intersectionFinderObject.rectangles.Count(); Assert.NotNull(intersectionFinderObject); Assert.Equal(expected, actual); }
public void LoadJson_MoreThanTenShouldContainsTen() { string jsonFilePath = Path.Combine(Environment.CurrentDirectory, @"Data", @"IntersectionFinder", @"more_than_ten.json"); IntersectionFinder intersectionFinderObject = IntersectionFinder.LoadJson(jsonFilePath); int expected = 10; int actual = intersectionFinderObject.rectangles.Count(); Assert.NotNull(intersectionFinderObject); Assert.Equal(expected, actual); }
public void FindIntersection(int[] arr1, int[] arr2, int[] arr3, int[] intersection) { var sut = new IntersectionFinder(); var result = sut.FindIntersection(arr1, arr2, arr3); result.Should().NotBeNull(); result.Should().HaveSameCount(intersection); result.SequenceEqual(intersection).Should().BeTrue(); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Stopwatch sw = new Stopwatch(); sw.Start(); UserSettings userSettings = new UserSettings(); var intersectionFinder = new IntersectionFinder(commandData.Application.ActiveUIDocument, userSettings); if (userSettings.FillElementParameters) { intersectionFinder.GetIntersection2(); } //intersectionFinder.TablCreate(); sw.Stop(); TaskDialog.Show("3", sw.Elapsed.ToString()); return(Result.Succeeded); }
// 开始具体的调试操作 private void DoSomething(DocumentModifier docMdf, SelectionSet impliedSelection) { var intSectionFinder = new IntersectionFinder(); intSectionFinder.Execute(docMdf); }
internal override void Paint(PointFeature point) { ISpatialDisplay display = ActiveDisplay; IDrawStyle style = Controller.DrawStyle; style.FillColor = style.LineColor = Color.Magenta; if (m_CurrentPoint!=null) style.Render(display, m_CurrentPoint); if (m_Start!=null && m_End!=null) { RenderGeometry(display, style); EditingController ec = EditingController.Current; if (ec.Project.Settings.AreIntersectionsDrawn && ArePointsDrawn() && AddingTopology()) { // The intersect geometry could be null when starting to add a new // circular arc LineGeometry line = GetIntersectGeometry(); if (line!=null) { IntersectionFinder xf = new IntersectionFinder(line, false); style.FillColor = Color.Transparent; xf.Render(display, style); } } } }
public void PuzzleFindFewestCombinedSteps() { string[] input = File.ReadAllText("Input.txt").Split(Environment.NewLine); Assert.Equal(12304, IntersectionFinder.FindFewestCombinedSteps(input[0], input[1])); }
public void FindingFewestCombinedSteps(string path1, string path2, int expectedSteps) { Assert.Equal(expectedSteps, IntersectionFinder.FindFewestCombinedSteps(path1, path2)); }
public void PuzzleClosestIntersection() { string[] input = File.ReadAllText("Input.txt").Split(Environment.NewLine); Assert.Equal(258, IntersectionFinder.FindClosestIntersectionDistance(input[0], input[1])); }
public void FindingClosestIntersection(string path1, string path2, int expectedDistance) { Assert.Equal(expectedDistance, IntersectionFinder.FindClosestIntersectionDistance(path1, path2)); }