I am currently into the testing stage of a project I am working on and am having trouble bringing the main service under test in anything other than the most basic default test cases.
The Service is currently responsible for the creation of all sub-components, which I would like to change to use an IoC container.
What container should...
CodeCampServer source code contains a generic StaticFactory.
I'm surmising that this is a key piece of the mechanism for how the framework plays well with Dependency Injection.
Subclasses of which use it's DefaultUnconfiguredState to provide static access to, well, a Default Unconfigured State for themselves which the dependency resolu...
I have a [Logger] attribute for my asp.net-mvc projects.
This LoggerAttribute takes a ILoggerService in it's constructor.
For regular objects (e.g. my controllers) it works, but attributes don't seem to be resolved.
How can I have Turbine inject the ILoggerService?
...
Is there a way via xml configuration to denote a static factory method on an object?
...
I've stumbled upon a rather strange issue today with Spring 3.0:
There's an abstract class A and its concrete implementation A_Impl. A_Impl is annotated as @Repository and is auto-scanned by Spring (<context:component-scan> and <context:annotation-config/> are both declared in context). A and A_Impl are deployed in separate JARs (not su...
If there are 3 interfaces like the following
public interface IWeapon {
void Kill();
}
public interface ISword:IWeapon {
void Slice();
}
public interface IShuriken: IWeapon {
void Pierce();
}
public class Ninja {
public IWeapon Weapon {get;set;}
public void BrutalKill() {
/* warrior must pierce, pierce, pierce and then kill
*/
}...
Is there any IOC container that already implements a controller factory compatible with asp.net mvc 2.0 ....if so i'll move my projects to 2.0 to test...
Anyone know a good reference about it?
...
I have a Presenter that takes a Service and a View Contract as parameters in its constructor:
public FooPresenter : IFooPresenter {
private IFooView view;
private readonly IFooService service;
public FooPresenter(IFooView view, IFooService service) {
this.view = view;
this.service = service;
}
}
I reso...
Hi everyone:
Just assume I have some class Foo, that has two dependencies: an ISerializer and an IFileAccessHandler.
Now this class also has other depedencies, functional dependencies. I don't want anyone instantiating this class in an invalid state, so I'd also need to pass a domain object in the constructor.
But how can I have tha...
Hi,
I want to wrap a number of classes implementing the Job interface with a JobEnabledDecorator object that determines whether or not it executes.
I am having trouble figuring out how to configure this in PicoContainer, so that it knows to create the Job implementation objects with a JobEnabledDecorator wrapping them.
Is this possi...
Hello,
I tried Google Guice the first time and find it very nice.
But, when I reached the part of Built-in Bindings I do not understand the examples.
For me it looks like I can use it for logging like an interceptor, but I don't know how.
Could someone of you explain this type of Binding and how I can use it? And maybe (if it's possib...
Hi there,
I am new to Mocking and somewhat familiar with unit testing and finally have decided to bite the bullet on a new project starting up front with a strict TDD approach. However I have one service class and method I need to retrospectively add tests to as it has been promoted from a prototype.
I do not know where to start thoug...
I am trying to get Unity to manage the creation of my objects and I want to have some initialization parameters that are not known until run-time:
At the moment the only way I could think of the way to do it is to have an Init method on the interface.
interface IMyIntf {
void Initialize(string runTimeParam);
string RunTimeParam { g...
Is it possible to use Dependency Injection (DI) with Windows PowerShell?
My intitial experiments suggest that it isn't. If I attempt to use Constructor Injection in a CmdLet it doesn't even register itself. In other words, this is not possible:
[Cmdlet(VerbsDiagnostic.Test, "Ploeh")]
public class PloehCmdlet : Cmdlet
{
public Ploeh...
When implementing the strategy pattern, how do you determine which class is responsible
for:
Selecting the specific concrete strategy implementation to pass to the Context class (assuming that the selection is based on some complex business logic and not a static flag)
Instantiating the aforementioned concrete implementation and actual...
In order to write testable C# code, I use DI heavily.
However lately I've been messing around with IronPython and found that as you can mock any methods/classes/functions etc... you like, the need for DI is gone.
Is this the case for dynamic langagues such as Python?
Instead of:
class Person(Address) {
...
You can have:
class Pers...
Can Unity automatically resolve IEnumerable<T>?
Let's say I have a class with this constructor:
public CoalescingParserSelector(IEnumerable<IParserBuilder> parserBuilders)
and I configure individual IParserBuilder instances in the container:
container.RegisterType<IParserSelector, CoalescingParserSelector>();
container.RegisterType<...
I've generated some service references to Amazon, and I was wondering if there was a good, quick way to generate mocks against the whole thing, or I instead I have to implement a mock binding, and do it that way
...
I have following snippet:
static void Main(string[] args) {
var container = new UnityContainer();
container.RegisterType<IConnection, SerialPortConnection>("SerialConnection");
container.RegisterType<IConnection, ParallelPortConnection>("ParallelConnection");
container.RegisterType<Device>("ParallelDevice");
containe...
I'm trying to use Guice to inject properties of a JSF managed bean. This is all running on Google App Engine (which may or may not be important)
I've followed the instructions here:
http://code.google.com/docreader/#p=google-guice&s=google-guice&t=GoogleAppEngine
One problem is in the first step. I can't subclass the Servlet...