public Either <DomainError, ServiceResponse> Execute(string playListName)
        {
            var newPlayListId = uniqueIdentifiers.GetNewUniqueIdentifier();
            var playList      = PlayList.Create(newPlayListId, playListName);

            playListPersistence.Persist(playList);
            playListNotifier.NotifyPlayListHasBeenCreated(playList.Id, playListName);
            return(ServiceResponse.Success);
        }
Example #2
0
        public Either <DomainError, ServiceResponse> Execute(string playListName)
        {
            var newPlayListId = uniqueIdentifiers.GetNewUniqueIdentifier();
            var playList      = PlayList.Create(newPlayListId, playListName);

            playListPersistence.Persist(playList);
            eventPublisher.Publish(playList.Events());
            return(ServiceResponse.Success);
        }
        public Either <DomainError, CommandResult> Handle(CreatePLayList command)
        {
            var newPlayListId = uniqueIdentifiers.GetNewUniqueIdentifier();
            var playList      = PlayList.Create(newPlayListId, command.PlayListName);

            playListPersistence.Persist(playList);
            eventPublisher.Publish(playList.Events());
            return(CommandResult.Success);
        }
        public void create_a_play_list()
        {
            var aPlaylistId   = APlaylist.Id;
            var aPlaylistName = APlaylist.Name;

            uniqueIdentifiers.GetNewUniqueIdentifier().Returns(aPlaylistId);

            var result = createPlayListService.Execute(aPlaylistName);

            result.IsRight.Should().BeTrue();
            VerifyPlayListHasBeenPersistedWith(aPlaylistId, aPlaylistName, PlayListStatus.Active);
            VerifyEventHasBeenRaised(new PlayListHasBeenCreated(aPlaylistId, aPlaylistName), eventPublisher);
        }