예제 #1
0
        public void GetAllByMarkId_ShouldReturnEmptyArray_WhenWrongMarkId()
        {
            // Arrange
            var context = GetContext(TestData.docs);
            var repo    = new SqlDocRepo(context);

            // Act
            var docs = repo.GetAllByMarkId(999);

            // Assert
            Assert.Empty(docs);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
예제 #2
0
        public void GetAllByMarkId_ShouldReturnDocs()
        {
            // Arrange
            var context = GetContext(TestData.docs);
            var repo    = new SqlDocRepo(context);

            var markId = _rnd.Next(1, _maxMarkId);

            // Act
            var docs = repo.GetAllByMarkId(markId);

            // Assert
            Assert.Equal(TestData.docs.Where(v => v.Mark.Id == markId), docs);

            context.Database.EnsureDeleted();
            context.Dispose();
        }