public void TestVariablesResolutionWithSingleLocation() { PropertyFileVariableSource vs = new PropertyFileVariableSource(); vs.Location = new AssemblyResource( "assembly://Spring.Core.Tests/Spring.Data.Spring.Objects.Factory.Config/one.properties"); // existing vars Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name")); Assert.AreEqual("32", vs.ResolveVariable("age")); // non-existant variable Assert.IsNull(vs.ResolveVariable("dummy")); }
public void TestMissingResourceLocation() { PropertyFileVariableSource vs = new PropertyFileVariableSource(); vs.IgnoreMissingResources = true; vs.Locations = new IResource[] { new AssemblyResource( "assembly://Spring.Core.Tests/Spring.Data.Spring.Objects.Factory.Config/non-existent.properties") , new AssemblyResource( "assembly://Spring.Core.Tests/Spring.Data.Spring.Objects.Factory.Config/one.properties") , }; // existing vars Assert.AreEqual("Aleks Seovic", vs.ResolveVariable("name")); Assert.AreEqual("32", vs.ResolveVariable("age")); }
public void TestVariablesResolutionWithTwoLocations() { PropertyFileVariableSource vs = new PropertyFileVariableSource(); vs.Locations = new IResource[] { new AssemblyResource( "assembly://Spring.Core.Tests/Spring.Data.Spring.Objects.Factory.Config/one.properties") , new AssemblyResource( "assembly://Spring.Core.Tests/Spring.Data.Spring.Objects.Factory.Config/two.properties") }; // existing vars Assert.AreEqual("Aleksandar Seovic", vs.ResolveVariable("name")); // should be overriden by the second file Assert.AreEqual("32", vs.ResolveVariable("age")); Assert.AreEqual("Marija,Ana,Nadja", vs.ResolveVariable("family")); // non-existant variable Assert.IsNull(vs.ResolveVariable("dummy")); }