private Mock <TeamCitySharp.ActionTypes.IBuilds> ExpectReadOfBuildStatus(string expectedBuildConfigurationId, Build expectedBuildInfo, Exception thrownException = null, BuildLocator locator = null) { var mockBuilds = new Mock <TeamCitySharp.ActionTypes.IBuilds>(MockBehavior.Strict); // The builds property will be accessed to get the build status clientMock.Setup(m => m.Builds).Returns(mockBuilds.Object); // This will read the build status if (locator == null) { if (thrownException == null) { mockBuilds.Setup(m => m.LastBuildByBuildConfigId(expectedBuildConfigurationId)).Returns(expectedBuildInfo); } else { mockBuilds.Setup(m => m.LastBuildByBuildConfigId(expectedBuildConfigurationId)).Throws(thrownException); } } else { mockBuilds.Setup(m => m.ByBuildLocator(It.Is <BuildLocator>(data => data.ToString() == locator.ToString()))) .Returns(new List <Build>() { expectedBuildInfo }); } return(mockBuilds); }
public void ReturnsWhenEmpty() { var locator = new BuildLocator(); Assert.AreEqual(string.Empty, locator.ToString()); }