public void Register_WithDefaultProperties_UsesComponentPathAndPackageGuidValue() { var attribute = new ProvideBindingPathAttribute(); var expectedKeys = new Hashtable() { //Build the data for each reg key entry in the hash table. { @"BindingPaths\".ToUpperInvariant() + ContextMock.GetType().GUID.ToString("B").ToUpperInvariant(), new Hashtable() { { Path.GetDirectoryName(Assembly.GetExecutingAssembly().EscapedCodeBase).ToUpperInvariant(), "" } } } }; AttributeCommonTest.RegistrationTest(attribute, expectedKeys, new BaseRegistrationContextMock()); }
public void Register_WithSubFolderSpecified_UsesPackageFolderTokenWithSubTokenAndPackageGuidValue() { var attribute = new ProvideBindingPathAttribute() { SubPath = "subFolder", }; var expectedKeys = new Hashtable() { //Build the data for each reg key entry in the hash table. { @"BindingPaths\".ToUpperInvariant() + ContextMock.GetType().GUID.ToString("B").ToUpperInvariant(), new Hashtable() { {Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().EscapedCodeBase),"subFolder").ToUpperInvariant(), ""} } } }; AttributeCommonTest.RegistrationTest(attribute, expectedKeys, new BaseRegistrationContextMock()); }
public void Register_WithSubFolderSpecified_UsesPackageFolderTokenWithSubTokenAndPackageGuidValue() { var attribute = new ProvideBindingPathAttribute() { SubPath = "subFolder", }; var expectedKeys = new Hashtable() { //Build the data for each reg key entry in the hash table. { @"BindingPaths\".ToUpperInvariant() + ContextMock.GetType().GUID.ToString("B").ToUpperInvariant(), new Hashtable() { { Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().EscapedCodeBase), "subFolder").ToUpperInvariant(), "" } } } }; AttributeCommonTest.RegistrationTest(attribute, expectedKeys, new BaseRegistrationContextMock()); }
private static void NullContextTestHelper(bool useRegisterMethod) { bool exceptionThrown = false; var attribute = new ProvideBindingPathAttribute(); try { if (useRegisterMethod) { attribute.Register(null); } else { attribute.Unregister(null); } } catch (ArgumentNullException) { exceptionThrown = true; } Assert.IsTrue(exceptionThrown); }