コード例 #1
0
        public void Should_ReturnNull_When_NullObjectProvided()
        {
            // Arrange
            var product = fixture.Generate <Product>();
            var mapper  = new ProductMapperProvider().Provide();

            // Act
            var result = mapper.Map <CartProductDto>(null);

            // Assert
            result.Should().BeNull();
        }
コード例 #2
0
        public void Should_ReturnValidDto()
        {
            // Arrange
            var product = fixture.Generate <Product>();
            var mapper  = new ProductMapperProvider().Provide();

            // Act
            var result = mapper.Map <CartProductDto>(product);

            // Assert
            result.Description.Should().Be(product.Description);
            result.Id.Should().Be(product.Id);
            result.Name.Should().Be(product.Name);
            result.Price.Should().Be(product.Price);
        }