Exemplo n.º 1
0
        public void Constructor_Should_HaveParameterlessConstructor()
        {
            // Arrange & Act
            var context = new LibrarySystemEfDbContext();

            // Assert
            Assert.IsInstanceOf <LibrarySystemEfDbContext>(context);
        }
Exemplo n.º 2
0
        public void Create_Should_ReturnNewDbContextInstance()
        {
            // Arrange & Act
            var newContext = LibrarySystemEfDbContext.Create();

            // Assert
            Assert.IsNotNull(newContext);
            Assert.IsInstanceOf <ILibrarySystemEfDbContext>(newContext);
        }
Exemplo n.º 3
0
        public void Books_ShouldBeInstanceOfIDbSet()
        {
            // Arrange & Act
            var context = new LibrarySystemEfDbContext();
            var books   = context.Books;

            // Assert
            Assert.IsInstanceOf <IDbSet <Book> >(books);
        }
Exemplo n.º 4
0
        public void Authors_ShouldBeInstanceOfIDbSet()
        {
            // Arrange & Act
            var context = new LibrarySystemEfDbContext();
            var authors = context.Authors;

            // Assert
            Assert.IsInstanceOf <IDbSet <Author> >(authors);
        }
Exemplo n.º 5
0
 public static void Initialize()
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <LibrarySystemEfDbContext, Configuration>());
     LibrarySystemEfDbContext.Create().Database.CreateIfNotExists();
 }