Esempio n. 1
0
        public void GetAllByDocTypeId_ShouldReturnEmptyArray_WhenWrongDocTypeId()
        {
            // Arrange
            var context = GetContext(TestData.linkedDocs);
            var repo    = new SqlLinkedDocRepo(context);

            // Act
            var linkedDocs = repo.GetAllByDocTypeId(999);

            // Assert
            Assert.Empty(linkedDocs);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Esempio n. 2
0
        public void GetAllByDocTypeId_ShouldReturnLinkedDocs()
        {
            // Arrange
            var context = GetContext(TestData.linkedDocs);
            var repo    = new SqlLinkedDocRepo(context);

            var docTypeId = _rnd.Next(1, TestData.linkedDocTypes.Count());

            // Act
            var linkedDocs = repo.GetAllByDocTypeId(docTypeId);

            // Assert
            Assert.Equal(TestData.linkedDocs.Where(
                             v => v.Type.Id == docTypeId), linkedDocs);

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