public void Build_descriptor_extra_params_set_to_null_should_acts_as_empty() { //Given, When var param1 = new BuildDescriptorParams("foo", "fizz", "buzz", false, null); var param2 = new BuildDescriptorParams("foo", "fizz", "buzz", false, new Dictionary<string, object>()); //Then param1.ShouldEqual(param2); }
public void Build_descriptor_params_should_act_as_a_unique_key() { //Given, When var param1 = new BuildDescriptorParams("foo", "fizz", "buzz", false, null); var param2 = new BuildDescriptorParams("foo", "bar", "buzz", false, null); var param3 = new BuildDescriptorParams("foo", "fizz", "buzz", true, null); //Then param1.ShouldNotEqual(param2); param1.ShouldNotEqual(param3); }
public virtual SparkViewDescriptor BuildDescriptor(BuildDescriptorParams buildDescriptorParams, ICollection <string> searchedLocations) { var descriptor = new SparkViewDescriptor { TargetNamespace = GetNamespaceEncodedPathViewPath(buildDescriptorParams.ViewPath) }; if (!LocatePotentialTemplate( PotentialViewLocations(buildDescriptorParams.ViewPath, buildDescriptorParams.ViewName, buildDescriptorParams.Extra), descriptor.Templates, searchedLocations)) { return(null); } if (!string.IsNullOrEmpty(buildDescriptorParams.MasterName)) { if (!LocatePotentialTemplate( PotentialMasterLocations(buildDescriptorParams.MasterName, buildDescriptorParams.Extra), descriptor.Templates, searchedLocations)) { return(null); } } else if (buildDescriptorParams.FindDefaultMaster && TrailingUseMasterName(descriptor) == null /*empty is a valid value*/) { LocatePotentialTemplate( PotentialDefaultMasterLocations(buildDescriptorParams.ViewPath, buildDescriptorParams.Extra), descriptor.Templates, null); } var trailingUseMaster = TrailingUseMasterName(descriptor); while (buildDescriptorParams.FindDefaultMaster && !string.IsNullOrEmpty(trailingUseMaster)) { if (!LocatePotentialTemplate( PotentialMasterLocations(trailingUseMaster, buildDescriptorParams.Extra), descriptor.Templates, searchedLocations)) { return(null); } trailingUseMaster = TrailingUseMasterName(descriptor); } return(descriptor); }
public virtual SparkViewDescriptor BuildDescriptor(BuildDescriptorParams buildDescriptorParams, ICollection<string> searchedLocations) { var descriptor = new SparkViewDescriptor { TargetNamespace = GetNamespaceEncodedPathViewPath(buildDescriptorParams.ViewPath) }; if (!LocatePotentialTemplate( PotentialViewLocations(buildDescriptorParams.ViewPath, buildDescriptorParams.ViewName, buildDescriptorParams.Extra), descriptor.Templates, searchedLocations)) { return null; } if (!string.IsNullOrEmpty(buildDescriptorParams.MasterName)) { if (!LocatePotentialTemplate( PotentialMasterLocations(buildDescriptorParams.MasterName, buildDescriptorParams.Extra), descriptor.Templates, searchedLocations)) { return null; } } else if (buildDescriptorParams.FindDefaultMaster && TrailingUseMasterName(descriptor) == null /*empty is a valid value*/) { LocatePotentialTemplate( PotentialDefaultMasterLocations(buildDescriptorParams.ViewPath, buildDescriptorParams.Extra), descriptor.Templates, null); } var trailingUseMaster = TrailingUseMasterName(descriptor); while (buildDescriptorParams.FindDefaultMaster && !string.IsNullOrEmpty(trailingUseMaster)) { if (!LocatePotentialTemplate( PotentialMasterLocations(trailingUseMaster, buildDescriptorParams.Extra ), descriptor.Templates, searchedLocations)) { return null; } trailingUseMaster = TrailingUseMasterName(descriptor); } return descriptor; }
public void Build_descriptor_extra_params_should_have_identical_equality() { //Given, When var param1 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new[] { "hippo", "lion" })); var param2 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new[] {"hippo"})); var param3 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new[] {"lion"})); var param4 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new[] {"lion", "hippo"})); var param5 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(null)); var param6 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new string[0])); var param7 = new BuildDescriptorParams("foo", "fizz", "buzz", false, Dict(new[] {"hippo", "lion"})); //Then param1.ShouldNotEqual(param2); param1.ShouldNotEqual(param3); param1.ShouldNotEqual(param4); param1.ShouldNotEqual(param5); param1.ShouldNotEqual(param6); param1.ShouldEqual(param7); }