Exemplo n.º 1
0
        public void MapBeerToDTO_ShouldReturnCorrectID()
        {
            //Arrange
            var cut = new Beer
            {
                ID      = 1,
                ABV     = 4.5f,
                Rating  = 2,
                Name    = "Carlsberg",
                Country = new Country()
                {
                    Name = "Bulgaria"
                },
                Brewery = new Brewery()
                {
                    Name = "Brewery", Country = new Country()
                    {
                        Name = "Germany"
                    }
                },
                Style = new BeerStyle()
                {
                    Name = "Ale"
                }
            };
            //Act
            var sut = cut.MapBeerToDTO();

            //Assert
            Assert.AreEqual(sut.ID, 1);
        }
Exemplo n.º 2
0
        public void MapBeerToDTO_ShouldReturnBreweryDTO()
        {
            //Arrange
            var cut = new Beer();
            //Act
            var sut = cut.MapBeerToDTO();

            //Assert
            Assert.IsInstanceOfType(sut, typeof(BeerDTO));
        }
Exemplo n.º 3
0
        public void MapBeerToDTO_ShouldReturnCorrectNameAndCountryAndBreweryAndStyleAndABVAndRating()
        {
            //Arrange
            var cut = new Beer
            {
                ABV     = 4.5f,
                Rating  = 2,
                Name    = "Carlsberg",
                Country = new Country()
                {
                    Name = "Bulgaria"
                },
                Brewery = new Brewery()
                {
                    Name = "Brewery", Country = new Country()
                    {
                        Name = "Germany"
                    }
                },
                Style = new BeerStyle()
                {
                    Name = "Ale"
                }
            };
            //Act
            var sut = cut.MapBeerToDTO();

            //Assert
            Assert.AreEqual(sut.Name, "Carlsberg");
            Assert.AreEqual(sut.Country.Name, "Bulgaria");
            Assert.AreEqual(sut.Brewery.Name, "Brewery");
            Assert.AreEqual(sut.Brewery.Country, "Germany");
            Assert.AreEqual(sut.Style.Name, "Ale");
            Assert.AreEqual(sut.ABV, 4.5f);
            Assert.AreEqual(sut.Rating, 2);
        }