Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Download this file using PowerShell v3 under Windows with the following comand:
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
# or wget:
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# OS generated files #
.DS_Store*
Icon?

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
*.Cache
ClientBin/
# [Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
modulesbin/
tempbin/

# EPiServer Site file (VPP)
AppData/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# vim
*.txt~
*.swp
*.swo

# svn
.svn

# Remainings from resolvings conflicts in Source Control
*.orig

# SQL Server files
**/App_Data/*.mdf
**/App_Data/*.ldf
**/App_Data/*.sdf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

# SASS Compiler cache
.sass-cache

# Visual Studio 2014 CTP
**/*.sln.ide

# Visual Studio temp something
.vs/

# VS 2015+
*.vc.vc.opendb
*.vc.db

# Rider
.idea/

**/node_modules/*

# Added by Jskonst
.vscode/
Properties/

#####
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
#####
31 changes: 31 additions & 0 deletions ConsoleApp1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{F184E3BB-49E2-41FC-9329-443EC130168D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XUnitTest", "XUnitTest\XUnitTest.csproj", "{A0A3BD81-4D5F-45BD-BC69-77BCCB9B0670}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F184E3BB-49E2-41FC-9329-443EC130168D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F184E3BB-49E2-41FC-9329-443EC130168D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F184E3BB-49E2-41FC-9329-443EC130168D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F184E3BB-49E2-41FC-9329-443EC130168D}.Release|Any CPU.Build.0 = Release|Any CPU
{A0A3BD81-4D5F-45BD-BC69-77BCCB9B0670}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0A3BD81-4D5F-45BD-BC69-77BCCB9B0670}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0A3BD81-4D5F-45BD-BC69-77BCCB9B0670}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0A3BD81-4D5F-45BD-BC69-77BCCB9B0670}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {800733AB-B5F3-4E25-A1EE-54D92F203662}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions ConsoleApp1/ConsoleApp1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
39 changes: 39 additions & 0 deletions ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
public class Program
{
public static Dictionary<string, string> Func(Dictionary<string, Dictionary<string, Dictionary<string, string>>> dict)
{
Dictionary<string, string> dictresult = new Dictionary<string, string>();
string path = "";
foreach (var a in dict)
{
path = a.Key + "/";
foreach (var b in a.Value)
{
path += b.Key + "/";
foreach (var c in b.Value)
{
dictresult.Add(path + c.Key, c.Value);
}
}
}
return dictresult;
}
static void Main(string[] args)
{
Dictionary<string, Dictionary<string, Dictionary<string, string>>> dict = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
dict.Add("a", new Dictionary<string, Dictionary<string, string>>());
dict["a"].Add("b", new Dictionary<string, string>());
dict["a"]["b"].Add("c", "12");
dict["a"]["b"].Add("d", "Hello World");
foreach (var a in Func(dict))
{
Console.Write(a + " ");
}
}
}
};
29 changes: 29 additions & 0 deletions XUnitTest/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using Xunit;

namespace ConsoleApp1
{
public class UnitTest1
{
[Fact]
public void CorrectTest()
{
Dictionary<string, Dictionary<string, Dictionary<string, string>>> dict = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
dict.Add("a", new Dictionary<string, Dictionary<string, string>>());
dict["a"].Add("b", new Dictionary<string, string>());
dict["a"]["b"].Add("c", "12");
dict["a"]["b"].Add("d", "Hello World");
Dictionary<string, string> correct = new Dictionary<string, string>();
correct.Add("a/b/c", "12");
correct.Add("a/b/d", "Hello World");
Assert.Equal(correct, Program.Func(dict));
}

[Fact]
public void EmptyTest()
{
Dictionary<string, Dictionary<string, Dictionary<string, string>>> dict = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
Assert.Equal(new Dictionary<string, string>(), Program.Func(dict));
}
}
}
20 changes: 20 additions & 0 deletions XUnitTest/XUnitTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ConsoleApp1\ConsoleApp1.csproj" />
</ItemGroup>

</Project>