public void ChunkSize_ValueIsEmpty_SetToDefault() { _gitExecutor.Setup(x => x.GetLong(GetConfigArgumentStringForInt(ConfigurationProvider.ChunkSizeConfigName))).Returns((int?)null); var target = new ConfigurationProvider(_gitExecutor.Object); Assert.AreEqual(ConfigurationProvider.DefaultChunkSize, target.ChunkSize); }
public void ChunkSize_ValueIsPositive_GetsSet() { _gitExecutor.Setup(x => x.GetLong(GetConfigArgumentStringForInt(ConfigurationProvider.ChunkSizeConfigName))).Returns(42); var target = new ConfigurationProvider(_gitExecutor.Object); Assert.AreEqual(42, target.ChunkSize); }
public void CacheDirectory_HasValue_GetsSet() { string gitDir = "directory"; string expectedDir = "directory\\git-bin"; _gitExecutor.Setup(x => x.GetString("rev-parse --git-dir")).Returns(gitDir); var target = new ConfigurationProvider(_gitExecutor.Object); Assert.AreEqual(expectedDir, target.CacheDirectory); }
public void ChunkSize_ValueIsNegative_Throws() { _gitExecutor.Setup(x => x.GetLong(GetConfigArgumentStringForInt(ConfigurationProvider.ChunkSizeConfigName))).Returns(-42); try { var target = new ConfigurationProvider(_gitExecutor.Object); } catch (ಠ_ಠ) { Assert.Pass(); } Assert.Fail("Exception not thrown for negative chunk size"); }
public void CacheDirectory_NoValue_Throws() { _gitExecutor.Setup(x => x.GetString("rev-parse --git-dir")).Returns(string.Empty); try { var target = new ConfigurationProvider(_gitExecutor.Object); } catch (ಠ_ಠ) { Assert.Pass(); } Assert.Fail("Exception not thrown for CacheDir"); }
public void S3SecretKey_NoValue_Throws() { _gitExecutor.Setup(x => x.GetString(GetConfigArgumentString(ConfigurationProvider.S3SecretKeyName))).Returns(string.Empty); try { var target = new ConfigurationProvider(_gitExecutor.Object); } catch (ಠ_ಠ) { Assert.Pass(); } Assert.Fail("Exception not thrown for S3SecretKey"); }
public void S3SecretKey_HasValue_GetsSet() { string key = "i am a key"; _gitExecutor.Setup(x => x.GetString(GetConfigArgumentString(ConfigurationProvider.S3SecretKeyName))).Returns(key); var target = new ConfigurationProvider(_gitExecutor.Object); Assert.AreEqual(key, target.S3SecretKey); }