예제 #1
0
        public async Task JsonFormat_ShouldBeWellFormed()
        {
            Repository.Projects.FindByNames(Arg.Any <IEnumerable <string> >()).Returns(new List <ProjectResource>
            {
                new ProjectResource {
                    Name = "ProjectA", Id = "projectaid"
                },
                new ProjectResource {
                    Name = "ProjectB", Id = "projectbid"
                },
                new ProjectResource {
                    Name = "Version controlled project", Id = VersionControlledProjectId
                }
            });

            Repository.Releases.FindMany(Arg.Any <Func <ReleaseResource, bool> >()).Returns(new List <ReleaseResource>
            {
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "1.0",
                    Assembled    = DateTimeOffset.MinValue,
                    ReleaseNotes = "Release Notes 1"
                },
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "2.0",
                    Assembled    = DateTimeOffset.MaxValue,
                    ReleaseNotes = "Release Notes 2"
                },
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "whateverdockerversion",
                    Assembled    = DateTimeOffset.MaxValue,
                    ReleaseNotes = "Release Notes 3"
                },
                new ReleaseResource
                {
                    ProjectId               = VersionControlledProjectId,
                    Version                 = "1.2.3",
                    Assembled               = DateTimeOffset.MaxValue,
                    ReleaseNotes            = "Version controlled release notes",
                    VersionControlReference = new VersionControlReferenceResource
                    {
                        GitCommit = "87a072ad2b4a2e9bf2d7ff84d8636a032786394d",
                        GitRef    = "main"
                    }
                }
            });

            CommandLineArgs.Add("--project=ProjectA");
            CommandLineArgs.Add("--outputFormat=json");

            await listReleasesCommand.Execute(CommandLineArgs.ToArray()).ConfigureAwait(false);

            this.Assent(LogOutput.ToString().ScrubApprovalString());
        }
예제 #2
0
 public bool SetAdditionalLibPaths(string[] additionalLibPaths)
 {
     if (additionalLibPaths != null && additionalLibPaths.Length > 0)
     {
         CommandLineArgs.Add("/lib:\"" + string.Join(";", additionalLibPaths) + "\"");
     }
     return(true);
 }
        public void ShouldNotCleanEnvironmentWithMissingStatusArgs()
        {
            CommandLineArgs.Add("-environment=Development");
            Func <Task> exec = () => listMachinesCommand.Execute(CommandLineArgs.ToArray());

            exec.ShouldThrow <CommandException>()
            .WithMessage("Please specify a status using the parameter: --status or --health-status");
        }
예제 #4
0
        public void ShouldNotCleanPoolWithMissingStatusArgs()
        {
            CommandLineArgs.Add("-workerpool=SomePool");
            Func <Task> exec = () => cleanPoolCommand.Execute(CommandLineArgs.ToArray());

            exec.ShouldThrow <CommandException>()
            .WithMessage("Please specify a status using the parameter: --health-status");
        }
예제 #5
0
            public bool SetModuleAssemblyName(string moduleAssemblyName)
            {
                if (!string.IsNullOrWhiteSpace(moduleAssemblyName))
                {
                    CommandLineArgs.Add("/moduleassemblyname:\"" + moduleAssemblyName + "\"");
                }

                return(true);
            }
예제 #6
0
            public bool SetMainEntryPoint(string targetType, string mainEntryPoint)
            {
                if (!string.IsNullOrWhiteSpace(mainEntryPoint))
                {
                    CommandLineArgs.Add("/main:\"" + mainEntryPoint + "\"");
                }

                return(true);
            }
예제 #7
0
            public bool SetAllowUnsafeBlocks(bool allowUnsafeBlocks)
            {
                if (allowUnsafeBlocks)
                {
                    CommandLineArgs.Add("/unsafe");
                }

                return(true);
            }
예제 #8
0
            public bool SetWin32Resource(string win32Resource)
            {
                if (!string.IsNullOrWhiteSpace(win32Resource))
                {
                    CommandLineArgs.Add("/win32res:\"" + win32Resource + "\"");
                }

                return(true);
            }
예제 #9
0
            public bool SetWarningsNotAsErrors(string warningsNotAsErrors)
            {
                if (!string.IsNullOrWhiteSpace(warningsNotAsErrors))
                {
                    CommandLineArgs.Add("/warnaserror-:" + warningsNotAsErrors);
                }

                return(true);
            }
예제 #10
0
            public bool SetRuleSet(string ruleSetFile)
            {
                if (!string.IsNullOrWhiteSpace(ruleSetFile))
                {
                    CommandLineArgs.Add("/ruleset:\"" + ruleSetFile + "\"");
                }

                return(true);
            }
예제 #11
0
            public bool SetOptimize(bool optimize)
            {
                if (optimize)
                {
                    CommandLineArgs.Add("/optimize");
                }

                return(true);
            }
예제 #12
0
            public bool SetDisabledWarnings(string disabledWarnings)
            {
                if (!string.IsNullOrWhiteSpace(disabledWarnings))
                {
                    CommandLineArgs.Add("/nowarn:" + disabledWarnings);
                }

                return(true);
            }
예제 #13
0
            public bool SetDelaySign(bool delaySignExplicitlySet, bool delaySign)
            {
                if (delaySignExplicitlySet)
                {
                    CommandLineArgs.Add("/delaysign" + (delaySign ? "+" : "-"));
                }

                return(true);
            }
예제 #14
0
            public bool SetDefineConstants(string defineConstants)
            {
                if (!string.IsNullOrWhiteSpace(defineConstants))
                {
                    CommandLineArgs.Add("/define:" + defineConstants);
                }

                return(true);
            }
예제 #15
0
            public bool SetCodePage(int codePage)
            {
                if (codePage != 0)
                {
                    CommandLineArgs.Add("/codepage:" + codePage);
                }

                return(true);
            }
예제 #16
0
            public bool SetCheckForOverflowUnderflow(bool checkForOverflowUnderflow)
            {
                if (checkForOverflowUnderflow)
                {
                    CommandLineArgs.Add("/checked");
                }

                return(true);
            }
예제 #17
0
            public bool SetBaseAddress(string baseAddress)
            {
                if (!string.IsNullOrWhiteSpace(baseAddress))
                {
                    CommandLineArgs.Add("/baseaddress:" + baseAddress);
                }

                return(true);
            }
예제 #18
0
            public bool SetNoConfig(bool noConfig)
            {
                if (noConfig)
                {
                    CommandLineArgs.Add("/noconfig");
                }

                return(true);
            }
예제 #19
0
            public bool SetNoStandardLib(bool noStandardLib)
            {
                if (noStandardLib)
                {
                    CommandLineArgs.Add("/nostdlib");
                }

                return(true);
            }
예제 #20
0
            public bool SetDocumentationFile(string documentationFile)
            {
                if (!string.IsNullOrWhiteSpace(documentationFile))
                {
                    CommandLineArgs.Add("/doc:\"" + documentationFile + "\"");
                }

                return(true);
            }
예제 #21
0
            public bool SetPdbFile(string pdbFile)
            {
                if (!string.IsNullOrWhiteSpace(pdbFile))
                {
                    CommandLineArgs.Add($"/pdb:\"{pdbFile}\"");
                }

                return(true);
            }
예제 #22
0
            public bool SetErrorReport(string errorReport)
            {
                if (!string.IsNullOrWhiteSpace(errorReport))
                {
                    CommandLineArgs.Add("/errorreport:" + errorReport.ToLower());
                }

                return(true);
            }
예제 #23
0
            public bool SetTreatWarningsAsErrors(bool treatWarningsAsErrors)
            {
                if (treatWarningsAsErrors)
                {
                    CommandLineArgs.Add("/warnaserror");
                }

                return(true);
            }
예제 #24
0
            public bool SetGenerateFullPaths(bool generateFullPaths)
            {
                if (generateFullPaths)
                {
                    CommandLineArgs.Add("/fullpaths");
                }

                return(true);
            }
예제 #25
0
            public bool SetWin32Icon(string win32Icon)
            {
                if (!string.IsNullOrWhiteSpace(win32Icon))
                {
                    CommandLineArgs.Add("/win32icon:\"" + win32Icon + "\"");
                }

                return(true);
            }
예제 #26
0
            public bool SetWin32Manifest(string win32Manifest)
            {
                if (!string.IsNullOrWhiteSpace(win32Manifest))
                {
                    CommandLineArgs.Add("/win32manifest:\"" + win32Manifest + "\"");
                }

                return(true);
            }
예제 #27
0
            public bool SetKeyContainer(string keyContainer)
            {
                if (!string.IsNullOrWhiteSpace(keyContainer))
                {
                    CommandLineArgs.Add("/keycontainer:\"" + keyContainer + "\"");
                }

                return(true);
            }
예제 #28
0
            public bool SetAddModules(string[] addModules)
            {
                if (addModules != null && addModules.Length > 0)
                {
                    CommandLineArgs.Add("/addmodule:\"" + string.Join(";", addModules) + "\"");
                }

                return(true);
            }
예제 #29
0
            public bool SetLangVersion(string langVersion)
            {
                if (!string.IsNullOrWhiteSpace(langVersion))
                {
                    CommandLineArgs.Add("/langversion:" + langVersion);
                }

                return(true);
            }
예제 #30
0
            public bool SetApplicationConfiguration(string applicationConfiguration)
            {
                if (!string.IsNullOrWhiteSpace(applicationConfiguration))
                {
                    CommandLineArgs.Add("/appconfig:" + applicationConfiguration);
                }

                return(true);
            }
예제 #31
0
		public IDisposable Play(MediaStreamInfo mediaStreamInfo, IPlaybackController playbackController) {
			//fix url
			var url = new Uri(mediaStreamInfo.url);
			if (url == null || !url.IsAbsoluteUri) {
				throw new Exception("Invalid playback url");
			}
			if (mediaStreamInfo.transport != MediaStreamInfo.Transport.Http) {
				if (String.Compare(url.Scheme, "rtsp", true) != 0) {
					throw new Exception("Invalid playback url");
				}
			} else if (String.Compare(url.Scheme, "rtsp", true) != 0) {
				int defPort;
				if (String.Compare(url.Scheme, Uri.UriSchemeHttp, true) == 0) {
					defPort = 80;
				} else if (String.Compare(url.Scheme, Uri.UriSchemeHttps, true) == 0) {
					defPort = 443;
				} else {
					throw new Exception("Invalid playback url");
				}
				var ub = new UriBuilder(url);
				ub.Scheme = "rtsp";
				if (ub.Port == -1) {
					ub.Port = defPort;
				}
				url = ub.Uri;
				mediaStreamInfo = new MediaStreamInfo(url.ToString(), mediaStreamInfo.transport, mediaStreamInfo.userNameToken);
			}

			var disposable = new SingleAssignmentDisposable();
			playerTask.mediaStreamInfo = mediaStreamInfo;
			playerTask.playbackController = playbackController;
			if (playerHost != null) {
				playerHost.Dispose();
				RemotingServices.Disconnect(playerHost);
				playerHost = null;
			}

			playerHost = new PlayerHost(playerTask);
			RemotingServices.Marshal(playerHost);
			var ipcChannel = AppHosting.SetupChannel();
			var hostControllerUri = RemotingServices.GetObjectUri(playerHost);
			var hostControllerUrl = ipcChannel.GetUrlsForUri(hostControllerUri).First();

			//start player host process
			var hostProcessArgs = new CommandLineArgs();
			var t = Uri.EscapeDataString(hostControllerUrl);
			hostProcessArgs.Add("controller-url", new List<string> { hostControllerUrl });

			var pi = new ProcessStartInfo() {
				FileName = Assembly.GetExecutingAssembly().Location,
				UseShellExecute = false,
				Arguments = String.Join(" ", hostProcessArgs.Format()),
			};
			pi.EnvironmentVariables["PATH"] = String.Join("; ", Bootstrapper.specialFolders.dlls.Select(sfd => sfd.directory.FullName).Append(pi.EnvironmentVariables["PATH"]));

			StartHostProcess(pi);
			return Disposable.Create(() => {
				Dispose();
			});
		}