public void TestSetup() { _id = 8; _name = "Test Config"; _configurationMock = MockRepository.GenerateMock<IRootConfigurationElement>(); _configurationMock.Stub(x => x.Name).Return(_name); _configurationMock.Id = _id; _configurationChildMock = MockRepository.GenerateMock<IConfigurationElement>(); _configurationChildMock.Stub(x => x.Name).Return("Child"); _configurationMock.Stub(x => x.Children).Return(new List<IConfigurationElement>(new [] { _configurationChildMock })); _configurationMock.Stub(x => x.Attributes).Return(new Dictionary<string, string>() { { "Attribute One", "Value One" }, { "Attribute Two", "Value Two" } }); _locatorMock = MockRepository.GenerateMock<IConfigurationResourceLocator>(); _locatorMock.Stub(x => x.Locate(Arg<string>.Is.NotEqual(_name))).Return(new IConfigurationElement[] { }); _locatorMock.Stub(x => x.Locate(Arg<string>.Is.Equal(_name))).Return(new IConfigurationElement[] { _configurationMock }); _watcherMock = MockRepository.GenerateMock<IConfigurationResourceWatcher>(); _repository = new WatchingConfigurationRepository(_locatorMock, _watcherMock); _locatorMock.Stub(x => x.Locate(Arg<string>.Is.Equal(_name))).Return(new[] { _configurationMock }); }