protected override void Given() { base.Given(); var customer = new CustomerModel(); _model = new OrderShipmentModel { ShippedDate = null, Items = new List<OrderItemShipmentModel> { new OrderItemShipmentModel { IsPackaged = true }, new OrderItemShipmentModel { IsPackaged = true }, new OrderItemShipmentModel { IsPackaged = true } } }; ViewModel.Initialize(customer, _model); }
private IOrderShipmentViewModel CreateOrderShipmentViewModel(CustomerModel customer, OrderShipmentModel model) { var viewModel = _viewModelFactory.CreateOrderShipmentViewModel(); viewModel.Initialize(customer, model); return viewModel; }
protected override void Given() { base.Given(); var orderInfo = new OrderInfoModel {CustomerId = CustomerId, Id = 1}; _customer = new CustomerModel {FirstName = "Kalle", LastName = "Kula", Id = CustomerId}; _ordersToShip = new[] { new OrderShipmentModel {Id = 1, OrderInfo = orderInfo}, new OrderShipmentModel {Id = 2, OrderInfo = orderInfo}, new OrderShipmentModel {Id = 3, OrderInfo = orderInfo} }; CustomerServiceMock.GetCustomerByIdAsync(Arg.Any<int>()).Returns(Task.FromResult(_customer)); ShipmentServiceMock.GetAllNotShippedShipmentsByCustomerIdAsync(Arg.Any<int>()).Returns(Task.FromResult(_ordersToShip)); }
protected override void Given() { base.Given(); _customer = new CustomerModel {Id = CustomerId}; _models = new[] { new OrderShipmentModel {Id = 1}, new OrderShipmentModel {Id = 2}, new OrderShipmentModel {Id = 3}, new OrderShipmentModel {Id = 4}, new OrderShipmentModel {Id = 5} }; _orderShipmentViewModel = Substitute.For<IOrderShipmentViewModel>(); ViewModel.PropertyChanged += (sender, args) => _raisedProperties.Add(args.PropertyName); LoaderMock.LoadAsync(Arg.Any<int>()).Returns(Task.FromResult(new ShipmentLoadResult {Customer = _customer, OrdersToShip = _models.ToList()})); ViewModelFactoryMock.CreateOrderShipmentViewModel().Returns(_orderShipmentViewModel); }
protected override void Given() { base.Given(); var customer = new CustomerModel(); var orderShipment = new OrderShipmentModel { Items = new List<OrderItemShipmentModel> { new OrderItemShipmentModel { IsPackaged = false }, new OrderItemShipmentModel { IsPackaged = true } } }; ViewModel.Initialize(customer, orderShipment); }
protected override void Given() { base.Given(); ViewModel.PropertyChanged += (sender, args) => _raisedProperties.Add(args.PropertyName); _customer = new CustomerModel { City = "Delivery town", FirstName = "John", LastName = "Doe", StreetAddress = "Delivery street 15", ZipCode = 12345 }; _allOrderItems = new[] { new OrderItemShipmentModel { Id = 1, IsPackaged = false, OrderItem = { Quantity = 3, Item = {Price = 18m} } }, new OrderItemShipmentModel { Id = 2, IsPackaged = true, OrderItem = { Quantity = 1, Item = {Price = 1.5m} } }, new OrderItemShipmentModel { Id = 3, IsPackaged = false, OrderItem = { Quantity = 4, Item = {Price = 100m} } }, new OrderItemShipmentModel { Id = 4, IsPackaged = true, OrderItem = { Quantity = 1, Item = {Price = 10m} } }, new OrderItemShipmentModel { Id = 5, IsPackaged = true, OrderItem = { Quantity = 10, Item = {Price = 10m} } }, new OrderItemShipmentModel { Id = 6, IsPackaged = true, OrderItem = { Quantity = 3, Item = {Price = 25} } }, new OrderItemShipmentModel { Id = 7, IsPackaged = false, OrderItem = { Quantity = 2, Item = {Price = 15.5m} } } }; _orderShipment = new OrderShipmentModel {Items = _allOrderItems, OrderInfo = {Id = OrderNumber}}; }