Esempio n. 1
0
        public void ThrowsWhenConfigSourceIsNull()
        {
            var factory = new FakeHosterFactory();
            var hoster  = new FakeHoster();

            factory.FakeHoster = hoster;

            var sut = new HosterApiCaller(factory);

            Assert.Throws <ArgumentNullException>(() => sut.GetRepositoryList(null));
        }
Esempio n. 2
0
        public void ThrowsWhenConfigSourceIsNull()
        {
            var factory = new FakeHosterFactory();
            var hoster  = new FakeHoster();

            factory.FakeHoster = hoster;

            var sut = new HosterValidator(factory);

            Assert.Throws <ArgumentNullException>(() => sut.Validate(null));
        }
Esempio n. 3
0
        public void GetRepositoryListCallsUnderlyingHosterApi()
        {
            var reader = new FakeConfigReader();

            reader.SetDefaultFakeConfig();
            var config = reader.ReadConfig();
            var source = config.Sources.First();

            var factory = new FakeHosterFactory();
            var hoster  = new FakeHoster();

            factory.FakeHoster = hoster;

            var sut = new HosterApiCaller(factory);

            sut.GetRepositoryList(source);

            Assert.True(hoster.FakeApi.WasCalled);
        }
Esempio n. 4
0
        public void ValidateCallsUnderlyingValidator()
        {
            var reader = new FakeConfigReader();

            reader.SetDefaultFakeConfig();
            var config = reader.ReadConfig();
            var source = config.Sources.First();

            var factory = new FakeHosterFactory();
            var hoster  = new FakeHoster();

            factory.FakeHoster = hoster;

            var sut = new HosterValidator(factory);

            sut.Validate(source);

            Assert.True(hoster.FakeValidator.WasValidated);
        }
Esempio n. 5
0
        public void MakeBackupCallsUnderlyingMethod()
        {
            var hoster = new FakeHoster();

            var factory = new FakeHosterFactory(hoster);
            var repo    = new HosterRepository("foo", "foo", "http://clone", ScmType.Git);

            repo.SetWiki(true, "http://wiki");
            repo.SetIssues(true, "http://issues");

            var reader = new FakeConfigReader();

            reader.SetDefaultFakeConfig();
            var config = reader.ReadConfig();
            var source = config.Sources.First();

            var sut = new HosterBackupMaker(factory);

            sut.MakeBackup(source, repo, "foo");

            Assert.True(hoster.FakeBackup.WasExecuted);
        }