public static void NotRecursive() { var resolver = new DictNameResolver(); resolver.Add("one", "1"); resolver.Add("two", "2"); resolver.Add("<", "%"); resolver.Add(">", "%"); Assert.Equal("1", resolver.ResolveWholeString("%one%")); Assert.Equal("12", resolver.ResolveWholeString("%one%%two%")); // directly adjacent Assert.Equal("%one%", resolver.ResolveWholeString("%<%one%>%")); // Not recurisve, only applied once. // Failure when resolving a missing item Assert.Throws <InvalidOperationException>(() => resolver.ResolveWholeString("%one%_%missing%")); }
public void TestNameResolver() { DictNameResolver nameResolver = new DictNameResolver(); nameResolver.Add("name", "VALUE"); FunctionDescriptor func = IndexMethod("NameResolver", nameResolver).Item1; Assert.NotNull(func); var parameters = func.Parameters; Assert.Equal(1, parameters.Count()); ParameterDescriptor firstParameter = parameters.First(); Assert.Equal("inputs", firstParameter.Name); Assert.IsType <BlobParameterDescriptor>(firstParameter); BlobParameterDescriptor blobParameter = (BlobParameterDescriptor)firstParameter; Assert.Equal(@"input", blobParameter.ContainerName); Assert.Equal(@"VALUE", blobParameter.BlobName); }