示例#1
0
        public void Setup()
        {
            slaveServiceMock            = new Mock <IConfigurationService>();
            cachingConfigurationService = new CachingConfigurationService((IConfigurationService)slaveServiceMock.Object);

            configurationMock = new Mock <IConfiguration>();
            configuration     = (IConfiguration)configurationMock.Object;
        }
        public void Setup()
        {
            slaveServiceMock            = new DynamicMock(typeof(IConfigurationService));
            cachingConfigurationService = new CachingConfigurationService((IConfigurationService)slaveServiceMock.MockInstance);

            configurationMock = new DynamicMock(typeof(IConfiguration));
            configuration     = (IConfiguration)configurationMock.MockInstance;
        }
示例#3
0
        public void InvalidatesCacheIfSlaveServiceChanges()
        {
            // Setup
            SlaveServiceForTestingEvents slaveService = new SlaveServiceForTestingEvents();

            cachingConfigurationService = new CachingConfigurationService(slaveService);
            IConfiguration configuration2 = (IConfiguration) new Mock <IConfiguration>().Object;

            // Execute & Verify
            slaveService.configuration = configuration;
            Assert.AreEqual(configuration, cachingConfigurationService.Load());

            slaveService.handler();
            slaveService.configuration = configuration2;
            Assert.AreEqual(configuration2, cachingConfigurationService.Load());

            VerifyAll();
        }