Ejemplo n.º 1
0
        public void add_diffrent_tagName_but_the_same_name_should_do_nothing()
        {
            var tagId = Guid.NewGuid();

            Given(new TagCreated(tagId, "test"));
            When(s => TagActions.Create(s, tagId, "test1"));
            Then();
        }
Ejemplo n.º 2
0
        public void when_tag_created_should_properly_create()
        {
            var tagId   = Guid.NewGuid();
            var tagName = "Test";

            Given();
            When(s => TagActions.Create(s, tagId, tagName));
            Then(new TagCreated(tagId, tagName));
        }
Ejemplo n.º 3
0
        public void when_tag_exists_should_do_nothing()
        {
            var tagId   = Guid.NewGuid();
            var tagName = "Test";

            Given(new TagCreated(tagId, tagName));
            When(s => TagActions.Create(s, Guid.NewGuid(), tagName));
            Then();
        }
Ejemplo n.º 4
0
        private T Parse(string fileContents)
        {
            var commentRegex = new Regex("//[^\n]*\n");

            fileContents = commentRegex.Replace(fileContents, "");

            var tags = MsdParser.Parser.Parse(fileContents).ToArray();

            _track = BuildTrack(tags);

            foreach (var tag in MsdParser.Parser.Parse(fileContents))
            {
                if (TagActions.ContainsKey(tag.Name))
                {
                    TagActions[tag.Name](tag, _track);
                }
            }

            PostprocessTrack(_track);

            return(_track);
        }
Ejemplo n.º 5
0
        public void add_many_tags_one_was_duplicated_by_name_should_skip_this_tag()
        {
            var ids = new Guid[6]
            {
                Guid.NewGuid(),
                Guid.NewGuid(),
                Guid.NewGuid(),
                Guid.NewGuid(),
                Guid.NewGuid(),
                Guid.NewGuid()
            };

            Given(new TagCreated(ids[0], "test"));
            Given(new TagCreated(ids[1], "test1"));
            Given(new TagCreated(ids[2], "test2"));

            When(s => TagActions.Create(s, ids[3], "test"));
            When(s => TagActions.Create(s, ids[4], "test3"));
            When(s => TagActions.Create(s, ids[5], "test4"));

            Then(new TagCreated(ids[4], "test3"));
            Then(new TagCreated(ids[5], "test4"));
        }
Ejemplo n.º 6
0
        public async Task <Guid> HandleAsync(CreateQuestion command)
        {
            var questionId = Guid.NewGuid();

            var questionStreamId = $"{StreamPrefix.Question}_{command.CreatedOn}";

            await _eventStoreConnectionProvider.Execute <QuestionState>(questionStreamId, s => QuestionActions.Create(s, questionId, command.Question));

            await _eventStoreConnectionProvider.Execute <QuestionState>(questionStreamId, s => TagActions.Create(s, questionId, command.Tag));


            return(questionId);
        }
Ejemplo n.º 7
0
        public async Task <Guid> HandleAsync(CreateTag command)
        {
            var streamId = $"{StreamPrefix.Question}_{command.User}";
            await _eventStoreConnectionProvider.Execute <QuestionState>(streamId, s => TagActions.Create(s, command.QuestionId, command.TagName));

            return(command.QuestionId);
        }