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); }
public async Task <Group> AddGroup(Group group) { return(await _groupStore.Add(group)); }
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(); } }