public void GetBarsGoogle_InvalidLatidute()
        {
            // Arrange
            GetBarListGoogle getBars = new GetBarListGoogle();

            // Act
            getBars.GetBarsAround("TEXT", "100", "100");
            // Assert, should be no exception
        }
Exemplo n.º 2
0
        public void GetBarsGoogle_GetBarsAround_NullData(string latitude, string longitude, string radius)
        {
            var emptyFetcher = new Mock <IHttpFetcher>();

            emptyFetcher.Setup(p => p.GetHttpStream(It.IsAny <string>())).Throws(new Exception("This should not have been thrown"));
            // Arrange
            var getBars = new GetBarListGoogle(emptyFetcher.Object);
            // Act && Assert
            var ex = Assert.Throws <ArgumentNullException>(() => getBars.GetBarsAround(latitude, longitude, radius));
        }
Exemplo n.º 3
0
        public void GetBarsGoogle_GetBarsAround_InvalidData(string latitude, string longitude, string radius, string exceptionMessage)
        {
            var emptyFetcher = new Mock <IHttpFetcher>();

            emptyFetcher.Setup(p => p.GetHttpStream(It.IsAny <string>())).Throws(new Exception("This should not have been thrown"));
            // Arrange
            var getBars = new GetBarListGoogle(emptyFetcher.Object);
            // Act
            var ex = Assert.Throws <ArgumentsForProvidersException>(() => getBars.GetBarsAround(latitude, longitude, radius));

            // now we can test the exception itself
            Assert.That(ex.InvalidArguments == exceptionMessage);
        }
Exemplo n.º 4
0
        public void GetBarsFourSquare_GetBarsAroundAsync_ValidData(string latitude, string longitude, string radius)
        {
            // Arrange
            var validFetcher = new Mock <IHttpFetcher>();

            validFetcher.Setup(p => p.GetHttpStreamAsync(It.IsAny <string>())).Returns(Task.Run(() => BarProviderTestData.GoogleValidDataResponse));
            var getBars = new GetBarListGoogle(validFetcher.Object);
            // Act
            var barList = getBars.GetBarsAroundAsync(latitude, longitude, radius).Result;

            // Assert
            Assert.NotNull(barList);
            foreach (var bar in barList)
            {
                Assert.NotNull(bar);
                Assert.NotNull(bar.Ratings);
                Assert.NotNull(bar.Title);
            }
        }
Exemplo n.º 5
0
        public void GetBarsFourSquare_GetBarsAround_ValidData(double latitude, double longitude, double radius)
        {
            // Arrange
            var validFetcher = new Mock <IHttpFetcher>();

            validFetcher.Setup(p => p.GetHttpStream(It.IsAny <string>())).Returns(BarProviderTestData.GoogleValidDataResponse);
            var getBars = new GetBarListGoogle(validFetcher.Object);
            // Act
            var barList = getBars.GetBarsAround(latitude, longitude, radius);

            // Assert
            Assert.NotNull(barList);
            foreach (var bar in barList)
            {
                Assert.NotNull(bar);

                Assert.NotNull(bar.Title);
            }
        }