示例#1
0
        public async Task TestThat_GetCoffeeShopLocation_When_ValidationDoesNotFail_Returns_NotNullLocation()
        {
            // Arrange
            var csvLineParser = new CsvLineParser();

            // Act
            var location = await csvLineParser.GetCoffeeShopLocation(MockObjects.ValidCsvLine1);

            // Assert
            Assert.NotNull(location);
        }
示例#2
0
        public async Task TestThat_GetCoffeeShopLocation_When_ValidatorDoesNotFail_Returns_LocationWithExpectedValues()
        {
            var csvLineParser = new CsvLineParser();

            // Act
            var location = await csvLineParser.GetCoffeeShopLocation(MockObjects.ValidCsvLine99);

            // Assert
            Assert.Equal(MockObjects.ShopLocation99.X, location.X);
            Assert.Equal(MockObjects.ShopLocation99.Y, location.Y);
            Assert.Equal(MockObjects.ShopLocation99.Tag, location.Tag);
        }
示例#3
0
        public async Task TestThat_GetCoffeeShopLocation_When_CsvLineHasErrorOnPositionTwo_Throws_DataValidationExceptionWithExpectedMessage()
        {
            // Arrange
            var csvLineParser = new CsvLineParser();

            // Act
            async Task Act() => await csvLineParser.GetCoffeeShopLocation(MockObjects.Token2ErrorCsvLine);

            // Assert
            var exception = await Assert.ThrowsAsync <DataValidationException>(Act);

            Assert.Equal(MockValues.IncorrectValuePosition2CsvLineExceptionMessage, exception.Message);
        }
示例#4
0
        public async Task TestThat_GetCoffeeShopLocation_When_CsvLineHasMoreThanThreeTokens_Throws_DataValidationExceptionWithExpectedMessage()
        {
            // Arrange
            var csvLineParser = new CsvLineParser();

            // Act
            async Task Act() => await csvLineParser.GetCoffeeShopLocation(MockObjects.MoreThanThreeTokensCsvLine);

            // Assert
            var exception = await Assert.ThrowsAsync <DataValidationException>(Act);

            Assert.Equal(MockValues.IncorrectNumberOfTokensCsvLineExceptionMessage, exception.Message);
        }
示例#5
0
        public async Task TestThat_GetCoffeeShopLocation_When_CsvLineIsEmpty_Throws_DataValidationExceptionWithExpectedMessage()
        {
            // Arrange
            var csvLineParser = new CsvLineParser();

            // Act
            async Task Act() => await csvLineParser.GetCoffeeShopLocation(MockObjects.StringNullCsvLine);

            // Assert
            var exception = await Assert.ThrowsAsync <DataValidationException>(Act);

            Assert.Equal(MockValues.NullOrEmptyCsvLineExceptionMessage, exception.Message);
        }