public void HookDiscovery_StandardResourceDefinition_CanDiscover() { // Arrange & act var hookConfig = new HooksDiscovery<Dummy>(MockProvider<Dummy>(new DummyResourceDefinition())); // Assert Assert.Contains(ResourceHook.BeforeDelete, hookConfig.ImplementedHooks); Assert.Contains(ResourceHook.AfterDelete, hookConfig.ImplementedHooks); }
public void HookDiscovery_InheritanceSubclass_CanDiscover() { // Arrange & act var hookConfig = new HooksDiscovery<AnotherDummy>(MockProvider<AnotherDummy>(new AnotherDummyResourceDefinition())); // Assert Assert.Contains(ResourceHook.BeforeDelete, hookConfig.ImplementedHooks); Assert.Contains(ResourceHook.AfterDelete, hookConfig.ImplementedHooks); }
public void HookDiscovery_WronglyUsedLoadDatabaseValueAttribute_ThrowsJsonApiSetupException() { // Act Action action = () => _ = new HooksDiscovery <YetAnotherDummy>(MockProvider <YetAnotherDummy>(new YetAnotherDummyResourceDefinition())); // Assert Assert.Throws <InvalidConfigurationException>(action); }
public void HookDiscovery_WronglyUsedLoadDatabaseValueAttribute_ThrowsJsonApiSetupException() { // assert Assert.Throws <JsonApiSetupException>(() => { // Arrange & act var hookConfig = new HooksDiscovery <YetAnotherDummy>(MockProvider <YetAnotherDummy>(new YetAnotherDummyResourceDefinition())); }); }
public void LoadDatabaseValues_Attribute_Not_Allowed() { // assert Assert.Throws <JsonApiSetupException>(() => { // arrange & act var hookConfig = new HooksDiscovery <YetAnotherDummy>(); }); }
public void Hook_Discovery_With_Inheritance() { // arrange & act var hookConfig = new HooksDiscovery <AnotherDummy>(); // assert Assert.Contains(ResourceHook.BeforeDelete, hookConfig.ImplementedHooks); Assert.Contains(ResourceHook.AfterDelete, hookConfig.ImplementedHooks); }
public void Multiple_Implementations_Of_ResourceDefinitions() { // assert Assert.Throws <JsonApiSetupException>(() => { // arrange & act var hookConfig = new HooksDiscovery <DoubleDummy>(); }); }