예제 #1
0
        /// <summary>
        /// Code ajouté lors de la création d'une action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListActions_ItemToCreate(object sender, EventArgs e)
        {
            VO_Action vNewItem = _Service.CreateAction();

            ListActions.AddItem(vNewItem.Id, vNewItem.Title);
            LoadAction(vNewItem.Id);
        }
예제 #2
0
        public async Task ActionService_CreateActionTest()
        {
            //Arrange
            var actionRepoMock = new Mock <IActionRepository>();
            var actionService  = new ActionService(actionRepoMock.Object);
            var actionType     = ActionTypeEnum.Feed;
            var userPet        = GetUserPetTest();
            var newAction      = new Domain.Entity.Action
            {
                ActionType = actionType,
                UserPet    = GetUserPetTest(),
                Date       = new DateTime(2019, 9, 6, 10, 15, 10),
                Id         = 1
            };

            actionRepoMock.Setup(repo => repo.CreateAction(userPet, actionType))
            .ReturnsAsync(newAction)
            .Verifiable();

            //Act
            var result = await actionService.CreateAction(actionType, userPet);

            //Assert

            Assert.IsType <Domain.Entity.Action>(result);
            actionRepoMock.Verify();
            Assert.Equal(actionType, result.ActionType);
            Assert.Equal(userPet.Id, result.UserPet.Id);
            Assert.Equal(1, result.Id);
        }
예제 #3
0
        public async Task ActionService_CreateActionTest_NullParameter()
        {
            //Arrange
            var actionRepoMock = new Mock <IActionRepository>();
            var actionService  = new ActionService(actionRepoMock.Object);
            var actionType     = ActionTypeEnum.Feed;

            //Act
            var result = await actionService.CreateAction(actionType, null);

            //Assert

            Assert.Null(result);
            actionRepoMock.Verify();
        }
예제 #4
0
        public void TestCreateAction()
        {
            //Arrange
            Guid id = Guid.NewGuid();

            HubManPractices.Models.Action ToCreate = new HubManPractices.Models.Action()
            {
                ActionID = id, ActionName = "Terminate", Client = new Client()
                {
                    ClientID = Guid.NewGuid(), ClientName = "Doha"
                }, Date = DateTime.Now
            };

            //Act
            actionService.CreateAction(ToCreate);

            //Assert
            //Verifies the Action has been inserted
            Assert.AreEqual(id, actionService.GetById(id).ActionID);
            Assert.IsTrue(actionService.GetActions().Count() == 3);
        }
예제 #5
0
 public Task CreateAction([Remainder] string text) => ActionService.CreateAction(text, Context);