Exemple #1
0
 public InvalidPostAgifyBadRequestTests() : base(serviceConfiguration: services =>
 {
     services.ReplaceWithFake <INicknameService>(new FakeNicknameServiceWithBadRequest());
 })
 {
     _context = GetDbContext <NicknamesContext>();
     _context.AddDefaultUser();
 }
 public ValidPostTests() : base(services =>
 {
     services.ReplaceWithFake <INicknameService>(new FakeNicknameServiceWithValidRequest());
 })
 {
     _context = GetDbContext <NicknamesContext>();
     _context.AddDefaultUser();
 }
Exemple #3
0
        public async Task WhenGet_AndNicknamesAreNotInDatabase_ThenApiErrorIsReturned()
        {
            _context.AddDefaultUser();
            const string ErrorCode = "validation_error";
            const string Message   = "Nickname for user admin is not found";

            var user = DataAccessTestData.DefaultUser;

            var client = CreateClient();

            var response = await client.GetAsync($"names/get/the_youngest/{user.Name}");

            var apiError = await JsonSerializer.DeserializeAsync <ApiError>(response.Content.ReadAsStream());

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.Equal(ErrorCode, apiError.ErrorCode);
            Assert.Equal(Message, apiError.Message);
        }
 public ValidGetTests()
 {
     _context = GetDbContext <NicknamesContext>();
     _context.AddDefaultUser();
 }