Example #1
0
        public async Task AddAsync_AddsItemToDatabase()
        {
            var numberOfItemsInDatabase = await _context.Topics.AsQueryable().CountAsync();

            await _service.CreateEntityAsync(new TopicDto { Id = "testTopic1", Name = "Test Topic", MaxAttemptCount = 2,
                                                            QuestionsPerAttempt = 17, TimeToPass = 25, TopicNumber = 5, SubjectId = "subject2" });

            _context.Topics.AsQueryable().CountAsync().Result.Should().Be(numberOfItemsInDatabase + 1);
            _validator.VerifyAll();
        }