public void Create_DtoIsNull_ThrowArgumentNullException()
        {
            _dto = null;
            _personGroupLogic = new PersonGroupLogic(_personGroupAPI.Object, _responseHelper.Object);

            Assert.That(() => _personGroupLogic.Create(_dto), Throws.ArgumentNullException);
        }
        public void Create_DtoIsInvalid_ThrowInvalidOperationException()
        {
            _dto = new PersonGroupDto {
                PersonGroupId = "$"
            };
            _personGroupLogic = new PersonGroupLogic(_personGroupAPI.Object, _responseHelper.Object);

            Assert.That(() => _personGroupLogic.Create(_dto), Throws.InvalidOperationException);
        }
        public void Train_PersonGroupDoesNotExist_ResponseDataMustBeFalse()
        {
            _personGroupAPI.Setup(api => api.Train("a"))
            .Returns(Task.FromResult(new HttpResponseMessage {
                StatusCode = HttpStatusCode.NotFound
            }));

            _responseHelper.Setup(rh => rh.CreateResponse <bool>(
                                      It.Is <HttpResponseMessage>(res => res.IsSuccessStatusCode == false),
                                      It.IsAny <string>()))
            .Returns(new Response {
                Data = false
            });

            _personGroupLogic = new PersonGroupLogic(_personGroupAPI.Object, _responseHelper.Object);

            var result = _personGroupLogic.Train("a");

            Assert.IsFalse((bool)result.Data);
        }
        public void Create_PersonGroupExists_ResponseDataMustBeFalse()
        {
            _personGroupAPI.Setup(api => api.Create("unit-test"))
            .Returns(Task.FromResult(new HttpResponseMessage {
                StatusCode = HttpStatusCode.Conflict
            }));
            _dto = new PersonGroupDto {
                PersonGroupId = "unit-test"
            };

            _responseHelper.Setup(rh => rh.CreateResponse <bool>(
                                      It.Is <HttpResponseMessage>(res => res.IsSuccessStatusCode == false),
                                      It.IsAny <string>()))
            .Returns(new Response {
                Data = false
            });

            _personGroupLogic = new PersonGroupLogic(_personGroupAPI.Object, _responseHelper.Object);

            var result = _personGroupLogic.Create(_dto);

            Assert.IsFalse((bool)result.Data);
        }
        public void Train_PersonGroupIsInvalid_ThrowArgumentNullException(string error)
        {
            _personGroupLogic = new PersonGroupLogic(_personGroupAPI.Object, _responseHelper.Object);

            Assert.That(() => _personGroupLogic.Train(error), Throws.ArgumentNullException);
        }