Beispiel #1
0
        public void DthStartup_GetProjectInformation(DnxSdk sdk)
        {
            var projectName = "EmptyConsoleApp";
            var testProject = _fixture.GetTestProjectPath(projectName);

            using (var server = DthTestServer.Create(sdk))
                using (var client = new DthTestClient(server))
                {
                    client.Initialize(testProject);

                    var projectInformation = client.DrainAllMessages()
                                             .RetrieveSingleMessage("ProjectInformation")
                                             .EnsureSource(server, client)
                                             .RetrievePayloadAs <JObject>()
                                             .AssertProperty("Name", projectName);

                    projectInformation.RetrievePropertyAs <JArray>("Configurations")
                    .AssertJArrayCount(2)
                    .AssertJArrayContains("Debug")
                    .AssertJArrayContains("Release");

                    var frameworkShortNames = projectInformation.RetrievePropertyAs <JArray>("Frameworks")
                                              .AssertJArrayCount(2)
                                              .Select(f => f["ShortName"].Value <string>());

                    Assert.Contains("dnxcore50", frameworkShortNames);
                    Assert.Contains("dnx451", frameworkShortNames);
                }
        }
Beispiel #2
0
        public void DthStartup_GetProjectInformation(string flavor, string os, string architecture)
        {
            var projectName     = "EmptyConsoleApp";
            var runtimeHomePath = _fixture.GetRuntimeHomeDir(flavor, os, architecture);
            var testProject     = _fixture.GetTestProjectPath(projectName);

            using (var server = DthTestServer.Create(runtimeHomePath, testProject))
                using (var client = new DthTestClient(server, 0))
                {
                    client.Initialize(testProject);

                    var response = client.GetResponse <ProjectMessage>();
                    Assert.NotNull(response);
                    Assert.Equal(server.HostId, response.HostId);
                    Assert.Equal(0, response.ContextId);
                    Assert.Equal("ProjectInformation", response.MessageType);

                    var projectInfo = response.Payload;
                    Assert.Equal(projectName, projectInfo.Name);
                    Assert.Equal(2, projectInfo.Configurations.Count);
                    Assert.Contains("Debug", projectInfo.Configurations);
                    Assert.Contains("Release", projectInfo.Configurations);

                    var frameworkShorNames = projectInfo.Frameworks.Select(f => f.ShortName);
                    Assert.Equal(3, frameworkShorNames.Count());
                    Assert.Contains("dnxcore50", frameworkShorNames);
                    Assert.Contains("dnx451", frameworkShorNames);
                    Assert.Contains("net46", frameworkShorNames);
                }
        }