Exemplo n.º 1
0
        public void CanDeserializeWithObjectRuntime(ProjectRuntimeName runtimeName)
        {
            var json = $@"
{{
    ""name"": ""test-project"",
    ""runtime"": {{
        ""name"": ""{runtimeName.ToString().ToLower()}"",
        ""options"": {{
            ""typeScript"": true,
            ""binary"": ""test-binary"",
            ""virtualEnv"": ""test-env""
        }}
    }}
}}
";

            var settings = _serializer.DeserializeJson <ProjectSettings>(json);

            Assert.NotNull(settings);
            Assert.IsType <ProjectSettings>(settings);
            Assert.Equal("test-project", settings.Name);
            Assert.Equal(runtimeName, settings.Runtime.Name);
            Assert.NotNull(settings.Runtime.Options);
            Assert.Equal(true, settings.Runtime.Options !.TypeScript);
            Assert.Equal("test-binary", settings.Runtime.Options.Binary);
            Assert.Equal("test-env", settings.Runtime.Options.VirtualEnv);
        }
Exemplo n.º 2
0
        public void CanDeserializeWithStringRuntime(ProjectRuntimeName runtimeName)
        {
            var yaml = $@"
name: test-project
runtime: {runtimeName.ToString().ToLower()}
";

            var model    = _serializer.DeserializeYaml <ProjectSettingsModel>(yaml);
            var settings = model.Convert();

            Assert.NotNull(settings);
            Assert.IsType <ProjectSettings>(settings);
            Assert.Equal("test-project", settings.Name);
            Assert.Equal(runtimeName, settings.Runtime.Name);
            Assert.Null(settings.Runtime.Options);
        }
Exemplo n.º 3
0
        public void CanDeserializeWithStringRuntime(ProjectRuntimeName runtimeName)
        {
            var json = $@"
{{
    ""name"": ""test-project"",
    ""runtime"": ""{runtimeName.ToString().ToLower()}""
}}
";

            var settings = _serializer.DeserializeJson <ProjectSettings>(json);

            Assert.NotNull(settings);
            Assert.IsType <ProjectSettings>(settings);
            Assert.Equal("test-project", settings.Name);
            Assert.Equal(runtimeName, settings.Runtime.Name);
            Assert.Null(settings.Runtime.Options);
        }
Exemplo n.º 4
0
        public void CanDeserializeWithObjectRuntime(ProjectRuntimeName runtimeName)
        {
            var yaml = $@"
name: test-project
runtime:
  name: {runtimeName.ToString().ToLower()}
  options:
    typescript: true
    binary: test-binary
    virtualenv: test-env
";

            var model    = _serializer.DeserializeYaml <ProjectSettingsModel>(yaml);
            var settings = model.Convert();

            Assert.NotNull(settings);
            Assert.IsType <ProjectSettings>(settings);
            Assert.Equal("test-project", settings.Name);
            Assert.Equal(runtimeName, settings.Runtime.Name);
            Assert.NotNull(settings.Runtime.Options);
            Assert.Equal(true, settings.Runtime.Options !.TypeScript);
            Assert.Equal("test-binary", settings.Runtime.Options.Binary);
            Assert.Equal("test-env", settings.Runtime.Options.VirtualEnv);
        }
Exemplo n.º 5
0
 public ProjectSettings(
     string name,
     ProjectRuntimeName runtime)
     : this(name, new ProjectRuntime(runtime))
 {
 }
Exemplo n.º 6
0
 public ProjectRuntime(ProjectRuntimeName name)
 {
     this.Name = name;
 }