Пример #1
0
        public string Get(string setting)
        {
            switch (setting)
            {
            case "init note":
                _noteRepository.RemoveAll();
                _noteRepository.Add(new Note()
                {
                    Id        = "1", Body = "Test note 1",
                    CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, UserId = 1
                });
                _noteRepository.Add(new Note()
                {
                    Id        = "2", Body = "Test note 2",
                    CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, UserId = 1
                });
                _noteRepository.Add(new Note()
                {
                    Id        = "3", Body = "Test note 3",
                    CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, UserId = 2
                });
                _noteRepository.Add(new Note()
                {
                    Id        = "4", Body = "Test note 4",
                    CreatedOn = DateTime.Now, UpdatedOn = DateTime.Now, UserId = 2
                });
                break;

            case "init stuff":
                _stuffRepository.RemoveAll();
                _stuffRepository.Add(new StuffItem
                {
                    Name        = "name1",
                    Description = "d1",
                    Tags        = new List <TagItem> {
                        new TagItem {
                            Id = 1, Value = "2"
                        }
                    }
                });
                break;

            default:
                return("Unknown");
            }

            return("Done");
        }
Пример #2
0
        public async Task AddStuffItem()
        {
            var item = new StuffItem
            {
                Name = "name1",
                Tags = new List <TagItem>
                {
                    new TagItem {
                        Value = "sience"
                    },
                    new TagItem {
                        Value = "red"
                    }
                }
            };

            await _service.Add(item);

            Assert.NotNull(item.Id);
        }
Пример #3
0
        public Stuff Create(Stuff newStuff)
        {
            var stuff = _stuffRepository.Add(newStuff);

            return(stuff);
        }