예제 #1
0
        public void GetEmployeeByValidIdIsPossible()
        {
            CreateANumberOfEmployees();
            var ids          = _sut.GetActualIds(_client);
            var response     = _sut.GetEntityById(_client, ids[0]);
            var employeeById = JsonConvert.DeserializeObject <EntityModel>(response.Content);

            StringAssert.StartsWith(ExpectedEmployeeName, employeeById.Name, "Expected Employee name differs from the actual one.");
        }
예제 #2
0
        public void GetByIdWithInvalidTokenIsNotAllowed()
        {
            CreateANumberOfEmployees();
            var ids = _sut.GetActualIds(_client);

            _sut = new RESTHelper(false);
            var response = _sut.GetEntityById(_client, ids[0]);

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized),
                        "Get by ID with the invalid token was allowed, but should not have been.");
        }