Exemplo n.º 1
0
        public void WhenOrderCreate_ShouldCreateWithNewIdAndCreateDate()
        {
            // ARRANGE
            var newOrder = _fixture.Create <OrderCreate>();
            var mockDb   = new Mock <IOrdersDb>();
            var orders   = new Orders.Business.Orders(mockDb.Object);

            // ACT
            var response = orders.CreateOrder(newOrder);

            // ASSERT
            Assert.IsNotNull(response.Id);
            Assert.IsNotNull(response.CreateDateTime);
        }
Exemplo n.º 2
0
        public void WhenOrderItemsHasNoItems_ShouldThrowCustomerCanNotBeNullException()
        {
            // ARRANGE
            var newOrder = _fixture
                           .Build <OrderCreate>()
                           .With(o => o.OrderItems, new List <OrderItem>())
                           .Create();

            var mockDb = new Mock <IOrdersDb>();
            var orders = new Orders.Business.Orders(mockDb.Object);

            // ASSERT
            // ACT
            Assert.ThrowsException <MustContainOrderItemException>(() => orders.CreateOrder(newOrder));
        }
Exemplo n.º 3
0
        public void WhenCustomerIsNotSpecified_ShouldThrowCustomerCanNotBeNullException()
        {
            // ARRANGE
            var newOrder = _fixture
                           .Build <OrderCreate>()
                           .Without(o => o.Customer)
                           .Create();

            var mockDb = new Mock <IOrdersDb>();
            var orders = new Orders.Business.Orders(mockDb.Object);

            // ASSERT
            // ACT
            Assert.ThrowsException <CustomerCanNotBeNullException>(() => orders.CreateOrder(newOrder));
        }