Esempio n. 1
0
        public async Task Should_return_null_if_permission_not_allowed()
        {
            RouteHandlers.ListDirectorsHandler = () => ListDirectorsRoute.Handle(() => Enumerable.Empty <Director>(), () => false, () => false);

            RouteHandlers.UpdateDirectorHandler = director => UpdateDirectorRoute.Handle(director, director1 => 9, () => true);

            var res = await this.client.GetAsync("/functional/directors");

            Assert.Equal(HttpStatusCode.Forbidden, res.StatusCode);
        }
Esempio n. 2
0
        public async Task Should_return_400_if_user_not_successfully_updated()
        {
            //Given
            RouteHandlers.UpdateDirectorHandler = director => UpdateDirectorRoute.Handle(director, newDirector => 0, () => true);

            //When
            var res = await this.client.PutAsync("/functional/directors/1", new StringContent(JsonConvert.SerializeObject(new Director {
                Name = "Plop"
            }), Encoding.UTF8, "application/json"));

            //Then
            Assert.Equal(400, (int)res.StatusCode);
        }