public TeamCity(string host, string userName, string password, bool usingSSL = true) { var connectionConfig = new TeamCityConnectionSettingsBuilder().ToHost(host).UsingSSL().AsUser(userName, password).Build(); var bootstrapper = new BootStrapper(connectionConfig); Builds = bootstrapper.Get <IBuildService>(); QueuedBuilds = bootstrapper.Get <IQueuedBuildService>(); }
public void UseXML_FavorXmlFlagSet() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.UsingXmlFormat().Build(); // Assert settings.FavorJsonOverXml.Should().BeFalse(); }
public void UsingSSL_TeamCityHostAddressUsingHttps() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.UsingSSL().Build(); // Assert settings.TeamCityHost.Should().Be(new Uri("https://localhost")); }
public void ToHost_TeamCityHostSet() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.ToHost("testHost").Build(); // Assert settings.TeamCityHost.Should().Be(new Uri("http://testHost")); }
public void AsGuest_UserNameSetToGuest() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.AsGuest().Build(); // Assert settings.Username.Should().Be("guest"); settings.Password.Should().BeEmpty(); settings.ConnectAsGuest.Should().BeTrue(); }
public void AsUser_UserNameAndPasswordSet() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.AsUser("user", "secret").Build(); // Assert settings.Username.Should().Be("user"); settings.Password.Should().Be("secret"); settings.ConnectAsGuest.Should().BeFalse(); }
public void DefaultValuesCorrect() { // Arrange var builder = new TeamCityConnectionSettingsBuilder(); // Act var settings = builder.Build(); // Assert settings.TeamCityHost.Should().Be(new Uri("http://localhost")); settings.Username.Should().Be("guest"); settings.Password.Should().BeNullOrEmpty(); settings.FavorJsonOverXml.Should().BeTrue(); }
public TeamCity(string host, string userName, string password, bool usingSSL = true) { var connectionConfig = new TeamCityConnectionSettingsBuilder().ToHost(host).UsingSSL(usingSSL).AsUser(userName, password).Build(); var bootstrapper = new ServiceCollection() .AddSingleton <IBuildService, BuildService>() .AddSingleton <IQueuedBuildService, QueuedBuildService>() .AddSingleton <IChangeService, ChangeService>() .AddSingleton <ITeamCityApiClient, TeamCityApiClient>() .AddSingleton(s => connectionConfig) .AddSingleton <IBuildTagsService, BuildTagsService>() .AddSingleton <IBuildPinningService, BuildPinningService>() .AddSingleton <IHttpClientWrapperFactory, HttpClientWrapperFactory>() .AddSingleton <IBuildTypeService, BuildServiceType>() .BuildServiceProvider(); Builds = bootstrapper.GetService <IBuildService>(); QueuedBuilds = bootstrapper.GetService <IQueuedBuildService>(); Changes = bootstrapper.GetService <IChangeService>(); BuildType = bootstrapper.GetService <IBuildTypeService>(); }