Пример #1
0
        public async Task <IActionResult> CreateGroup(CreateGroupStationInputModel group)
        {
            var commandHandler = new CreateGroupStationCommandHandler(_groupRepository);

            var result = await commandHandler.Execute(group);

            if (result)
            {
                return(Ok(commandHandler.HandlerMessage));
            }

            return(NoContent());
        }
Пример #2
0
        public async Task Should_CreateGroupStationCommandHandler()
        {
            var groupStation = _factoryCreateGroup.CreateGroupStationInputModel();

            A.CallTo(() => _groupRepository.Add(A <GroupStation> .Ignored)).Returns(Task.CompletedTask);

            var commandHandler = new CreateGroupStationCommandHandler(_groupRepository);

            var result = await commandHandler.Execute(groupStation);

            Assert.IsTrue(result);
            Assert.AreEqual("Group has been added", commandHandler.HandlerMessage);
            Assert.Pass();
        }