Ejemplo n.º 1
0
        public void TestGeneratedCsv()
        {
            // TODO: uncomment one of the following two lines depending on whether you're generating numbers with or without padding.
            var expected = this.GetPlaces("expectedWithoutPadding.csv");
            //var expected = this.GetPlaces("expectedWithPadding.csv");

            //TODO: invoke your code here to generate the "actual.csv" file
            InMemoryData dataTree = new InMemoryData(
                new CSVFileGenerator(),
                new CustomConfiguration(),
                new TreeBuildService()
                );

            dataTree.GenerateFile();

            var actual = this.GetPlaces(Environment.CurrentDirectory +  "\\actual.csv");

            // Feel free to modify the checks to add additional logging or assertions to assist troubleshooting
            Assert.AreEqual(expected.Count, actual.Count);

            foreach (var expectedKey in expected.Keys)
            {
                var expectedPlace = expected[expectedKey];
                var actualPlace = actual[expectedKey];

                Assert.AreEqual(expectedPlace.PublicId.ToLower(), actualPlace.PublicId.ToLower());
                Assert.AreEqual(expectedPlace.PublicParentId.ToLower(), actualPlace.PublicParentId.ToLower());
                Assert.AreEqual(expectedPlace.Type.ToLower(), actualPlace.Type.ToLower());
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Unity IoC container to resolve dependency injection
            var container = new UnityContainer();

            container.RegisterType <IFileGenerator, CSVFileGenerator>();
            container.RegisterType <ICustomConfiguration, CustomConfiguration>();
            container.RegisterType <ITreeBuildService, TreeBuildService>();

            InMemoryData datatree = container.Resolve <InMemoryData>();

            datatree.GenerateFile();
        }