コード例 #1
0
        public void GeneratesValidPaths()
        {
            var expected = Directory.GetCurrentDirectory();
            var subject  = TsDir.Create(expected);

            var actual = subject.ToPath();

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void GeneratesValidPath_with_filename()
        {
            var expected = Directory.GetCurrentDirectory();
            var subject  = TsDir.Create(expected);

            var actual = subject.ToPath("test.ts");

            Assert.Equal(Path.Combine(expected, "test.ts"), actual);
        }
コード例 #3
0
        private TsDir CreateTestingTree()
        {
            var currentDir = TsDir.Create(Directory.GetCurrentDirectory());

            currentDir
            .Down("types")
            .Down("models")
            .Down("a")
            .Up()
            .Down("b")
            .Up()
            .Up()
            .Down("controllers")
            .Up()
            .Down("services");

            return(currentDir);
        }
コード例 #4
0
        public TypeBuilder(params Assembly[] additionalAssemblies)
        {
            RootDir = TsDir.Create(Directory.GetCurrentDirectory()).Down("Types");

            _allTypes = Assembly.GetExecutingAssembly()
                        .GetReferencedAssemblies()
                        .Select(Assembly.Load)
                        .Union(new[]
            {
                Assembly.GetExecutingAssembly(),
                Assembly.GetCallingAssembly(),
                Assembly.GetEntryAssembly()
            })
                        .Union(Assembly.GetCallingAssembly().GetReferencedAssemblies().Select(Assembly.Load))
                        .Union(Assembly.GetEntryAssembly().GetReferencedAssemblies().Select(Assembly.Load))
                        .Union(additionalAssemblies)
                        .SelectMany(x => x.GetTypes())
                        .ToArray();

            //todo move all .net types into definitions, to do this we need a way to indicate a type that doesn't necessarily need to be imported. That way a user could swap out all instances of a type (like DateTime) with a specific typescript/javascript type or even a type from a library import. Should also change it so that a type can have multiple associated files with it, files would associate back to a type so you could do file->type->files[]
        }