Exemplo n.º 1
0
        public OrderDetailTests()
        {
            _orderDetail = new OrderDetail();

            var fixture = new OmitRecursionFixture();

            _shopItem = fixture.Create <ShopItem>();
            _order    = fixture.Create <Order>();
        }
Exemplo n.º 2
0
        public ShopItemTests()
        {
            _shopItem = new ShopItem();

            var fixture = new OmitRecursionFixture();

            _category = fixture.Create <Category>();

            fixture.Freeze <ShopItem>();
            _shopItemLeft  = fixture.Create <ShopItem>();
            _shopItemRight = fixture.Create <ShopItem>();
        }
Exemplo n.º 3
0
        public OrderTests()
        {
            var fixture = new OmitRecursionFixture();

            _orderDetails = fixture.CreateMany <OrderDetail>().ToList();

            _customer = fixture.Create <Customer>();

            _orderPlaced = fixture.Create <DateTime>();

            _order = new Order();
        }
Exemplo n.º 4
0
        public CategoryTests()
        {
            _category = new Category();

            var fixture = new OmitRecursionFixture();

            _shopItems = fixture.CreateMany <ShopItem>().ToList();

            fixture.Freeze <Category>();
            _categoryLeft  = fixture.Create <Category>();
            _categoryRight = fixture.Create <Category>();
        }
Exemplo n.º 5
0
        public void TestToHtmlShouldReturnHtmlStringWithOrderValues()
        {
            //Arrange
            var fixture = new OmitRecursionFixture();
            var sut     = fixture.Create <Order>();

            //Act
            var result = sut.ToHtmlMessage();

            //Assert
            Assert.NotNull(result);
            Assert.StartsWith("<html>", result);
            Assert.Contains(sut.Id.ToString(), result);
            Assert.Contains(sut.OrderPlaced.ToString(CultureInfo.CurrentCulture), result);
            foreach (var orderDetail in sut.OrderDetails)
            {
                Assert.Contains(orderDetail.ShopItem.Name, result);
                Assert.Contains(orderDetail.Amount.ToString(), result);
                Assert.Contains((orderDetail.Price * orderDetail.Amount).ToString("C"), result);
            }

            Assert.Contains(sut.OrderTotal.ToString("C"), result);

            Assert.EndsWith("</html>", result);
        }