예제 #1
0
        public async Task PackDetail_Success()
        {
            //Arrange
            var loadingPlaces = new List <LoadingPlace> {
                new LoadingPlace(), new LoadingPlace()
            };

            deliveryService.Setup(x => x.GetPack(packId)).Returns(Task.FromResult(new PackToDelivery {
                Id = packId
            }));
            deliveryService.Setup(x => x.GetLoadingPlaces(It.IsAny <LoadingPlaceFilteringData>())).Returns(Task.FromResult(loadingPlaces));

            //Act
            var action = await deliveryController.PackDetail(packId) as ViewResult;

            var model = action.Model as PackDetailViewModel;

            //Assert
            Assert.Equal(packId, model.PackToDelivery.Id);
            Assert.Equal(loadingPlaces.Count, model.LoadingPlaces.Count);
        }