コード例 #1
0
        public void CreateGroup(string name, int length)
        {
            if (_groupStore.Exists(x => x.Name == name) || _textStore.Exists(x => x.Name == name))
            {
                throw new ArgumentException($"Cannot create group because another item in the database already has the name {name}.");
            }
            IGroupModel model = _modelFactory.GetGroupModel(name, length);

            _groupStore.Add(model);
        }
コード例 #2
0
 public async Task <Group> AddGroup(Group group)
 {
     return(await _groupStore.Add(group));
 }
コード例 #3
0
        public void TestAdd()
        {
            string name;

            _uniqueNames.TryPop(out name);
            IGroupModel model = _modelFactory.GetGroupModel(name, UniversalConstants.CountSize);

            _groupStore.Add(model);
            Grouping result = _db.Groupings.FirstOrDefault(x => x.Name == name);

            Assert.IsNotNull(result);
            if (result != null)
            {
                _db.Groupings.Remove(result);
                _db.SaveChanges();
            }
        }