Пример #1
0
        public void CreateGroupShouldDelegateToEntityManagerWithCorrectCollectionNameAndUser()
        {
            var group = new UsergridGroup();

            _client.CreateGroup(group);

            _entityManager.Received(1).CreateEntity("groups", group);
        }
Пример #2
0
        public void UpdateGroupShouldDelegateToEntityManagerrWithCorrectCollectionNameAndGroupPathAsTheIdentifier()
        {
            var group = new UsergridGroup {Path = "groupPath"};

            _client.UpdateGroup(group);

            _entityManager.Received(1).UpdateEntity("groups", group.Path, group);
        }
Пример #3
0
        public void UpdateGroupShouldPassOnTheException()
        {
            var group = new UsergridGroup {Path = "groupPath"};

            _entityManager
                .When(m => m.UpdateEntity("groups", group.Path, group))
                .Do(m => { throw new UsergridException(new UsergridError {Description = "Exception message"}); });

            _client.UpdateGroup(group);
        }
Пример #4
0
        public void GetGroupShouldReturnUsergridGroup()
        {
            var usergridGroup = new UsergridGroup();
            _entityManager.GetEntity<UsergridGroup>("groups", "identifier").Returns(x => usergridGroup);

            var returnedGroup = _client.GetGroup<UsergridGroup>("identifier");

            Assert.AreEqual(usergridGroup, returnedGroup);
        }