示例#1
0
        public void CanUpdate(Guid id, string nameBeforeUpdate, string nameAfterUpdate)
        {
            var settingsBeforeUpdate = new ConnectionSettingsA {
                Id = id, Name = nameBeforeUpdate
            };

            var settingsStoreMock = new Mock <IConnectionSettingsStore>();

            settingsStoreMock.Setup(m => m.Load()).Returns(new ConnectionSettings[] { settingsBeforeUpdate });

            var repository = new ConnectionSettingsRepository(settingsStoreMock.Object);

            var factoryMock = new Mock <IBuildProviderStrategy>();

            var connectionPool = new ConnectionPool(repository, factoryMock.Object);

            var settingsToUpdate = new ConnectionSettingsA {
                Id = id, Name = nameAfterUpdate
            };

            repository.Update(settingsToUpdate);

            var connection = connectionPool.CurrentConnections.Single();

            connection.Settings.Name.ShouldBe(nameAfterUpdate);
        }