Esempio n. 1
0
        public async void GetAvailableLogicAppActionsTest()
        {
            var actionIds = _fixture.Create <List <string> >();

            _actionLogicMock.Setup(mock => mock.GetAllActionIdsAsync()).ReturnsAsync(actionIds);

            var result = await _actionsController.GetAvailableLogicAppActions();

            var viewResult = result as PartialViewResult;
            var model      = viewResult.Model as ActionPropertiesModel;

            Assert.Equal(model.UpdateActionModel.ActionSelectList.Count, actionIds.Count);
            Assert.Equal(model.UpdateActionModel.ActionSelectList.First().Text, actionIds.First());
            Assert.Equal(model.UpdateActionModel.ActionSelectList.First().Value, actionIds.First());

            _actionLogicMock.Setup(mock => mock.GetAllActionIdsAsync()).ReturnsAsync(null);
            result = await _actionsController.GetAvailableLogicAppActions();

            viewResult = result as PartialViewResult;
            model      = viewResult.Model as ActionPropertiesModel;
            Assert.Equal(model.UpdateActionModel.ActionSelectList.Count, 0);
        }