public void CustomConstraints_additionalConstraintNotNull() { var customConstraints = new CustomConstraints("1.2", "abc"); Assert.That(customConstraints.Version, Is.EqualTo("1.2")); Assert.That(customConstraints.AdditionalConstraint, Is.EqualTo("abc")); }
public void GenerateReleaseNotes() { const string outputFile = @".\ReleaseNoteGenerator-UnitTest\output.html"; var constraints = new CustomConstraints ("2.0.2", null); using (var reader = new StreamReader (ResourceManager.GetResourceStream ("Issues_v2.0.2_complete.xml"))) { _jiraIssueAggregatorStub.Stub (stub => stub.GetXml (constraints)).Return (XDocument.Load (reader)); } using (var reader = new StreamReader (ResourceManager.GetResourceStream ("Issues_v2.0.2_complete.xml"))) { var issues = XDocument.Load (reader); var config = XDocument.Load (_configuration.ConfigFile); config.Root.Add (new XElement ("generatedForVersion", "2.0.2")); issues.Root.AddFirst (config.Elements()); _xmlTransformerStub.Expect (mock => mock.GenerateResultFromXml ( Arg<XDocument>.Matches (d => d.ToString() == issues.ToString()), Arg.Is (outputFile))).Return (0); } var exitCode = _releaseNoteGenerator.GenerateReleaseNotes (constraints, outputFile, null); Assert.That (exitCode, Is.EqualTo (0)); _xmlTransformerStub.VerifyAllExpectations(); }
public void CustomConstraints_additionalConstraintNotNull() { var customConstraints = new CustomConstraints ("1.2", "abc"); Assert.That (customConstraints.Version, Is.EqualTo ("1.2")); Assert.That (customConstraints.AdditionalConstraint, Is.EqualTo ("abc")); }
public void GenerateReleaseNotes() { const string outputFile = @".\ReleaseNoteGenerator-UnitTest\output.html"; var constraints = new CustomConstraints("2.0.2", null); using (var reader = new StreamReader(ResourceManager.GetResourceStream("Issues_v2.0.2_complete.xml"))) { _jiraIssueAggregatorStub.Stub(stub => stub.GetXml(constraints)).Return(XDocument.Load(reader)); } using (var reader = new StreamReader(ResourceManager.GetResourceStream("Issues_v2.0.2_complete.xml"))) { var issues = XDocument.Load(reader); var config = XDocument.Load(_configuration.ConfigFile); config.Root.Add(new XElement("generatedForVersion", "2.0.2")); issues.Root.AddFirst(config.Elements()); _xmlTransformerStub.Expect(mock => mock.GenerateResultFromXml( Arg <XDocument> .Matches(d => d.ToString() == issues.ToString()), Arg.Is(outputFile))).Return(0); } var exitCode = _releaseNoteGenerator.GenerateReleaseNotes(constraints, outputFile, null); Assert.That(exitCode, Is.EqualTo(0)); _xmlTransformerStub.VerifyAllExpectations(); }
public void GenerateReleaseNotes_InvalidVersion() { const string outputFile = @".\ReleaseNoteGenerator-UnitTest\output.html"; var constraints = new CustomConstraints ("unknownVersion", null); _jiraIssueAggregatorStub.Stub (stub => stub.GetXml (constraints)).Throw (new WebException ("The remote server returned an error: (400) Bad Request.")); var exitCode = _releaseNoteGenerator.GenerateReleaseNotes (constraints, outputFile, null); Assert.That (exitCode, Is.EqualTo (1)); }
public void GenerateReleaseNotes_InvalidVersion() { const string outputFile = @".\ReleaseNoteGenerator-UnitTest\output.html"; var constraints = new CustomConstraints("unknownVersion", null); _jiraIssueAggregatorStub.Stub(stub => stub.GetXml(constraints)).Throw(new WebException("The remote server returned an error: (400) Bad Request.")); var exitCode = _releaseNoteGenerator.GenerateReleaseNotes(constraints, outputFile, null); Assert.That(exitCode, Is.EqualTo(1)); }
public void GetXml_VersionWithoutMissingParents() { using (var reader = new StreamReader(ResourceManager.GetResourceStream("Issues_v1.2_closed.xml"))) { var xmlFile = XDocument.Load(reader); var constraints = new CustomConstraints("1.2", null); _jiraClientStub.Stub(stub => stub.GetIssuesByCustomConstraints(constraints)).Return(xmlFile); var emptyXml = new XDocument(new XElement("rss", new XElement("channel"))); _jiraClientStub.Stub(stub => stub.GetIssuesByKeys(new string[0])).Return(emptyXml); var output = _jiraIssueAggregator.GetXml(constraints); var expectedOutput = xmlFile; Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString())); } }
public void GetXml_VersionWithoutMissingParents() { using (var reader = new StreamReader (ResourceManager.GetResourceStream ("Issues_v1.2_closed.xml"))) { var xmlFile = XDocument.Load (reader); var constraints = new CustomConstraints ("1.2", null); _jiraClientStub.Stub (stub => stub.GetIssuesByCustomConstraints (constraints)).Return (xmlFile); var emptyXml = new XDocument (new XElement ("rss", new XElement ("channel"))); _jiraClientStub.Stub (stub => stub.GetIssuesByKeys (new string[0])).Return (emptyXml); var output = _jiraIssueAggregator.GetXml (constraints); var expectedOutput = xmlFile; Assert.That (output.ToString(), Is.EqualTo (expectedOutput.ToString())); } }
public void GetXml_VersionWithMissingParents() { var constraints = new CustomConstraints("2.0.2", null); using (var reader = new StreamReader(ResourceManager.GetResourceStream("Issues_v2.0.2.xml"))) { _jiraClientStub.Stub(stub => stub.GetIssuesByCustomConstraints(constraints)).Return(XDocument.Load(reader)); } using (var reader = new StreamReader(ResourceManager.GetResourceStream("Issues_COMMONS-4.xml"))) { _jiraClientStub.Stub(stub => stub.GetIssuesByKeys(new[] { "COMMONS-4" })).Return(XDocument.Load(reader)); } using (var resultReader = new StreamReader(ResourceManager.GetResourceStream("Issues_v2.0.2_complete.xml"))) { var output = _jiraIssueAggregator.GetXml(constraints); var expectedOutput = XDocument.Load(resultReader); Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString())); } }
public void GetXml_VersionWithMissingParents() { var constraints = new CustomConstraints ("2.0.2", null); using (var reader = new StreamReader (ResourceManager.GetResourceStream ("Issues_v2.0.2.xml"))) { _jiraClientStub.Stub (stub => stub.GetIssuesByCustomConstraints (constraints)).Return (XDocument.Load (reader)); } using (var reader = new StreamReader (ResourceManager.GetResourceStream ("Issues_COMMONS-4.xml"))) { _jiraClientStub.Stub (stub => stub.GetIssuesByKeys (new[] { "COMMONS-4" })).Return (XDocument.Load (reader)); } using (var resultReader = new StreamReader (ResourceManager.GetResourceStream ("Issues_v2.0.2_complete.xml"))) { var output = _jiraIssueAggregator.GetXml (constraints); var expectedOutput = XDocument.Load (resultReader); Assert.That (output.ToString(), Is.EqualTo (expectedOutput.ToString())); } }