public async Task TestCreateOrder()
        {
            // Arrange
            using (var service = ServiceMocker.GetSalesService())
            {
                var header = new Order
                {
                    OrderDate     = DateTime.Now,
                    OrderStatusID = 100,
                    CustomerID    = 1,
                    EmployeeID    = 1,
                    ShipperID     = 1
                };

                var details = new List <OrderDetail>
                {
                    new OrderDetail {
                        ProductID = 1, Quantity = 1
                    }
                };

                // Act
                var response = await service.CreateOrderAsync(header, details.ToArray());

                // Assert
                Assert.False(response.DidError);
            }
        }
        public async Task TestUpdateOrder()
        {
            // Arrange
            using (var service = ServiceMocker.GetSalesService())
            {
                var id = 1;

                // Act
                var response = await service.GetOrderAsync(id);

                // Assert
                Assert.False(response.DidError);
            }
        }
        public async Task TestGetOrders()
        {
            // Arrange
            using (var service = ServiceMocker.GetSalesService())
            {
                var pageSize   = 10;
                var pageNumber = 1;

                // Act
                var response = await service.GetOrdersAsync(pageSize, pageNumber);

                // Assert
                Assert.False(response.DidError);
            }
        }
        public async Task TestRemoveOrder()
        {
            // Arrange
            using (var service = ServiceMocker.GetSalesService())
            {
                var id = 601;

                // Act
                var response = await service.RemoveOrderAsync(id);

                // Assert
                Assert.False(response.DidError);
                Assert.True(response.Model == null);
            }
        }
        public async Task TestRemoveOrder()
        {
            // Arrange
            using (var service = ServiceMocker.GetSalesService())
            {
                var id = 601;

                // Act
                var response = await service.RemoveOrderAsync(id);

                // Assert
                Assert.True(response.DidError);
                Assert.True(response.ErrorMessage == String.Format(SalesDisplays.RemoveOrderExceptionMessage, id));
            }
        }
Ejemplo n.º 6
0
        public async Task TestUpdateEmployee()
        {
            // Arrange
            using (var service = ServiceMocker.GetHumanResourcesService())
            {
                var entity = (await service.GetEmployeeAsync(new Employee {
                    EmployeeID = 1
                })).Model;

                entity.FirstName  = "John III";
                entity.MiddleName = "Smith III";
                entity.LastName   = "Doe III";
                entity.BirthDate  = DateTime.Now.AddYears(-18);

                // Act
                var response = await service.UpdateEmployeeAsync(entity);

                // Assert
                Assert.False(response.DidError);
            }
        }