예제 #1
0
        private async void FactoryCreation(String factoryType)
        {
            var parameters = new Dictionary <string, string>
            {
                { "{NAMESPACE}", "BuiltDesignPatternsTest.FactoryTest.Shape" + factoryType },
                { "{PARENT_OBJECT}", "Shape" }
            };
            var shapes = new Dictionary <String, List <String> >
            {
                {
                    "{OBJECT}", new List <string>
                    {
                        "Circle",
                        "Square"
                    }
                }
            };

            var designPatternBuilder = new DesignPatternBuilder(_dpFileManager);

            var files  = designPatternBuilder.BuildFromXml(factoryType + ".xml", parameters, shapes).Result;
            var folder = await _dpFileManager.GetApplicationStorageFolder("TestDrops");

            foreach (var classInformation in files)
            {
                await _dpFileManager.CreateFile(classInformation.FileName, folder,
                                                classInformation.Content);

                var fileExits = _dpFileManager.FileExistsInFolder(classInformation.FileName, folder).Result;
                Assert.IsTrue(fileExits);
            }
        }
        private async void SingletonBuilder(String type)
        {
            var classValues = new Dictionary <string, string>
            {
                { "{NAMESPACE}", "BuiltDesignPatternsTest.SingletonTest" },
                { "{CLASS_NAME}", "My" + type }
            };

            var designPatternBuilder = new DesignPatternBuilder(_dpFileManager);
            var classInformation     = designPatternBuilder.BuildFromXml(type + ".xml", classValues, null).Result.First();

            var folder = await _dpFileManager.GetApplicationStorageFolder("TestDrops");

            await _dpFileManager.CreateFile(classInformation.FileName, folder,
                                            classInformation.Content);

            var fileExits = _dpFileManager.FileExistsInFolder(classInformation.FileName, folder).Result;

            Assert.IsTrue(fileExits);
        }