public void TestToString() { IBlobPathSource path1 = BlobPathSource.Create(@"container/dir/subdir/{name}.csv"); IBlobPathSource path2 = BlobPathSource.Create(@"container/dir/subdir/{name}.csv"); IBlobPathSource path3 = BlobPathSource.Create(@"container/dir/subdir/other.csv"); Assert.AreEqual(path1.ToString(), path2.ToString()); Assert.AreNotEqual(path2.ToString(), path3.ToString()); }
public void GetNames() { var path = BlobPathSource.Create(@"container/{name}-{date}.csv"); var d = path.ParameterNames; var names = d.ToArray(); Assert.AreEqual(2, names.Length); Assert.AreEqual("name", names[0]); Assert.AreEqual("date", names[1]); }
private static IDictionary <string, string> Match(string a, string b) { var pathA = BlobPathSource.Create(a); BlobPath pathB = null; BlobPath.TryParse(b, false, out pathB); IReadOnlyDictionary <string, object> bindingData = pathA.CreateBindingData(pathB); if (bindingData == null) { return(null); } IDictionary <string, string> matches = new Dictionary <string, string>(); foreach (KeyValuePair <string, object> item in bindingData) { matches.Add(item.Key, item.Value.ToString()); } return(matches); }
public void BlobPathSource_Throws_OnContainerResolves() { var exc = Assert.Throws <FormatException>(() => BlobPathSource.Create("container{resolve}/blob")); StringAssert.Contains("Container paths cannot contain {resolve} tokens.", exc.Message); }
public void BlobPathSource_Throws_OnEmpty() { var exc = Assert.Throws <FormatException>(() => BlobPathSource.Create("/")); StringAssert.Contains("Paths must be in the format 'container/blob'", exc.Message); }