예제 #1
0
        public void ShouldBeAbleToGetGeneratedDtoAssembly()
        {
            string curDir = Environment.CurrentDirectory;
            string newDir = Path.Combine(curDir, string.Format("{0}_{1}"._Format(MethodBase.GetCurrentMethod().Name, 4.RandomLetters())));

            if (!Directory.Exists(newDir))
            {
                Directory.CreateDirectory(newDir);
            }
            Environment.CurrentDirectory = newDir;
            Assembly assembly     = typeof(MainObject).Assembly;
            string   pocoAssembly = Dto.GetDefaultFileName(assembly);

            if (File.Exists(pocoAssembly))
            {
                File.Delete(pocoAssembly);
            }

            // Do it thrice to ensure testing of multiple execution paths within implementation
            GeneratedAssemblyInfo assemblyInfo = Dto.GetGeneratedDtoAssemblyInfo(typeof(MainObject).Assembly);

            assemblyInfo = Dto.GetGeneratedDtoAssemblyInfo(typeof(MainObject).Assembly);
            assemblyInfo = Dto.GetGeneratedDtoAssemblyInfo(typeof(MainObject).Assembly);

            Environment.CurrentDirectory = curDir;
        }