Ejemplo n.º 1
0
        public void ShouldGetCorrectVersionNumber()
        {
            var sut          = new GitHubAppUpdater(GetAppUpdateDetail());
            var latestVerion = sut.GetLatestVesrion();

            Assert.AreEqual("1.0.0.11", latestVerion);
        }
Ejemplo n.º 2
0
        public void ShouldThrowExceptionWhenSourceIsNotReachableGit()
        {
            var httpEngine = Mock.Create <IHttpEngine>();

            Mock.Arrange(() => httpEngine.GetHttpResponseAsync(Arg.AnyString)).Throws(new AggregateException("Unit Test"));

            var sut = new GitHubAppUpdater(httpEngine, new AppUpdateDetail(string.Empty, string.Empty));

            Assert.Throws <LocationNotReachableException>(() => sut.GetLatestVesrion());
        }
Ejemplo n.º 3
0
        public void ShouldThrowExceptionWhenSourceIsNotReachableGit()
        {
            var gitHub = Mock.Create <IGitHub>();

            Mock.Arrange(() => gitHub.ReadAllTextAysnc(Arg.AnyString)).Throws(new AggregateException("Unit Test"));

            var sut = new GitHubAppUpdater(gitHub, new AppUpdateDetail(string.Empty, string.Empty));

            Assert.Throws <LocationNotReachableException>(() => sut.GetLatestVesrion());
        }
Ejemplo n.º 4
0
        public void ShouldGetCorrectVersionNumberGit()
        {
            var httpEngine = Mock.Create <IGitHub>();

            var dic = new Dictionary <string, object> {
                { "download_url", "urlfortest" }
            };

            Mock.Arrange(() => httpEngine.ReadAllTextAysnc(Arg.AnyString)).Returns(() => Task.Run(() => "1.0.0.11")).OccursOnce();

            var sut          = new GitHubAppUpdater(httpEngine, new AppUpdateDetail(string.Empty, string.Empty));
            var latestVerion = sut.GetLatestVesrion();

            Assert.AreEqual("1.0.0.11", latestVerion);

            Mock.AssertAll(httpEngine);
        }
Ejemplo n.º 5
0
        public void ShouldThrowExceptionWhenSourceIsNotReachable()
        {
            var sut = new GitHubAppUpdater(new AppUpdateDetail(@"https://api.github.com/repos/MrBailwal/Repo", ""));

            Assert.Throws <LocationNotReachable>(() => sut.GetLatestVesrion());
        }