Exemple #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);
        }
Exemple #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));
        }
Exemple #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));
        }