예제 #1
0
        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);
        }
예제 #2
0
        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);
        }