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

            // Act
            var linkedDoc = repo.GetById(999);

            // Assert
            Assert.Null(linkedDoc);

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

            int id = _rnd.Next(1, TestData.linkedDocs.Count());

            // Act
            var linkedDoc = repo.GetById(id);

            // Assert
            Assert.Equal(TestData.linkedDocs.SingleOrDefault(v => v.Id == id),
                         linkedDoc);

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