public static void GivenInvliadRawSourceServerData_WhenParsing_ThenValuesShouldTHeExpectedOne(string raw) { HttpSourceServerDescriptor descriptor; var success = HttpSourceServerDescriptor.TryParse(raw, out descriptor); Assert.IsFalse(success); }
public static void GivenHttpRawSourceServerData_WhenParsing_ThenValuesShouldTHeExpectedOne( string raw, int expectedVersion, string expectedVersionControl, string expectedTarget, int expectedSourceFilesCount) { HttpSourceServerDescriptor descriptor; var success = HttpSourceServerDescriptor.TryParse(raw, out descriptor); Assert.IsTrue(success); Assert.That(descriptor.Version, Is.EqualTo(expectedVersion)); Assert.That(descriptor.VersionControl, Is.EqualTo(expectedVersionControl)); Assert.That(descriptor.Target, Is.EqualTo(expectedTarget)); Assert.That(descriptor.SourceFiles.Length, Is.EqualTo(expectedSourceFilesCount)); }
public static void GivenAListOfSourceServerDescriptor_WhenMergingThem_ThenItShouldBeProperlyMerged( int expectedVersion, string expectedVersionControl, string expectedTarget, IDictionary <string, string> expectedSourceFiles, HttpSourceServerDescriptor primary, IEnumerable <HttpSourceServerDescriptor> other) { var merged = primary.MergeWith(other); Assert.That(merged.Version, Is.EqualTo(expectedVersion)); Assert.That(merged.VersionControl, Is.EqualTo(expectedVersionControl)); Assert.That(merged.Target, Is.EqualTo(expectedTarget)); CollectionAssert.AreEquivalent( expectedSourceFiles, merged.SourceFiles.Select(file => file.Variables) .ToDictionary(vars => vars.ElementAt(0), vars => vars.ElementAt(1))); }
public static IEnumerable <string> GivenSourceServerDataObject_WhenCallingToString_ThenAProperRawValueIGenerated(HttpSourceServerDescriptor descriptor) { return(descriptor.ToString().GetLines()); }