public void ConvertToBuild() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildModel = new BuildModel { Status = "FAILURE", BuildType = new BuildConfiguration {Id = "bt2"}, BuildTypeId = "bt2" }; var build = buildModelToBuildConverter.ConvertToBuild(buildModel); // Assert build.Status.Should().Be(BuildStatus.Failure); build.BuildConfiguration.Id.Should().Be("bt2"); }
public void ConvertToBuilds_BuildStatusSuccess() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildWrapper = new BuildWrapper { Build = new List<BuildModel> {new BuildModel { Status = "SUCCESS", WebUrl = @"http://teamcity/buildid" }}, Count = "1" }; var builds = buildModelToBuildConverter.ConvertToBuilds(buildWrapper); // Assert builds.Single().Status.Should().Be(BuildStatus.Success); builds.Single().WebUrl.Should().Be(@"http://teamcity/buildid"); }
public void ConvertToBuilds_BuildTypeNotNull_BuildConfigurationInitialized() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildWrapper = new BuildWrapper { Build = new List<BuildModel> {new BuildModel { Status = "SUCCESS", BuildType = new BuildConfiguration { Id = "bt2"}, BuildTypeId = "WRONG" }}, Count = "1" }; var builds = buildModelToBuildConverter.ConvertToBuilds(buildWrapper); // Assert builds.Single().Status.Should().Be(BuildStatus.Success); builds.Single().BuildConfiguration.Id.Should().Be("bt2"); }
public void ConvertToBuilds_BuildProperties() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildWrapper = new BuildWrapper { Build = new List<BuildModel> {new BuildModel { Status = "SUCCESS", Properties = new Properties { Property = new List<Property> { new Property { Name = "Property1", Value = "Value1"} } } }}, Count = "1" }; var builds = buildModelToBuildConverter.ConvertToBuilds(buildWrapper); // Assert builds.Single().Properties.Property.Single().Name.Should().Be("Property1"); builds.Single().Properties.Property.Single().Value.Should().Be("Value1"); }
public void ConvertToBuilds_StatusIsNull_StatusIsNull() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildWrapper = new BuildWrapper { Build = new List<BuildModel> {new BuildModel { Status = null, BuildType = new BuildConfiguration { Id = "bt2"}, BuildTypeId = "WRONG" }}, Count = "1" }; var builds = buildModelToBuildConverter.ConvertToBuilds(buildWrapper); // Assert builds.Single().Status.HasValue.Should().BeFalse(); builds.Single().BuildConfiguration.Id.Should().Be("bt2"); }
public void ConvertToBuilds_State() { var buildModelToBuildConverter = new BuildModelToBuildConverter(); var buildWrapper = new BuildWrapper { Build = new List<BuildModel> { new BuildModel { Id = 1, State = "Queued" }, new BuildModel { Id = 2, State = "running" }, new BuildModel { Id = 3, State = "FINISHED" } }, Count = "3" }; var builds = buildModelToBuildConverter.ConvertToBuilds(buildWrapper); // Assert builds.Single(_ => _.Id == 1).State.Should().Be(BuildState.Queued); builds.Single(_ => _.Id == 2).State.Should().Be(BuildState.Running); builds.Single(_ => _.Id == 3).State.Should().Be(BuildState.Finished); }