Esempio n. 1
0
        public void RelationshipRepository_Should_Set_DbContext()
        {
            var DbContextMock = new Mock <INotebookDbContext>();

            var repo = new RelationshipRepository();

            Assert.DoesNotThrow(() => repo.setContext(DbContextMock.Object));
        }
Esempio n. 2
0
        public void RelationshipsRepository_Should_Throw_Exception()
        {
            var DbContextMock = new Mock <INotebookDbContext>();

            var repo = new RelationshipRepository();

            repo.setContext(DbContextMock.Object);

            Assert.Throws <ArgumentNullException>(() => repo.Find("test", "test2", "test3"));
        }
Esempio n. 3
0
        public void RelationshipRepository_Should_Call_Remove()
        {
            var DbContextMock = new Mock <INotebookDbContext>();

            DbContextMock.Setup(c => c.Relationships.Remove(It.IsAny <Relationship>()));

            var repo = new RelationshipRepository();

            repo.setContext(DbContextMock.Object);

            repo.Delete(new Relationship());

            DbContextMock.Verify(c => c.Relationships.Remove(It.IsAny <Relationship>()), Times.Once);
        }