public void TestUsingDynamicRepository_ManualRegistration_Success() { ICustomerRepository customerRepository = new CustomerRepositoryPlugin(); DynamicCommands.RegisterTarget(customerRepository); Command <ICustomerRepository> command = DynamicCommands.Get <ICustomerRepository>(); Customer expected = command.Execute(repo => repo.AddCustomer("Bob")); Customer actual = command.Execute(repo => repo.GetCustomer("Bob")); Assert.Equal(expected, actual); Assert.Equal("Bob", actual.Name); }
public void TestUsingStaticRepository_StaticDeclaration_Success() { ICustomerRepository customerRepository = new CustomerRepositoryPlugin(); CommandRouter.Default.RegisterTarget(customerRepository); Command <ICustomerRepository> command = Repositories.CustomerRepositoryCommand; Customer expected = command.Execute(repo => repo.AddCustomer("Bob")); Customer actual = command.Execute(repo => repo.GetCustomer("Bob")); Assert.Equal(expected, actual); Assert.Equal("Bob", actual.Name); }