Ejemplo n.º 1
0
        public void BeTypeOfICarsDbContext()
        {
            // Arrange
            var db = new EfMarvelCatalogDbContext();

            // Act & Assert
            Assert.IsInstanceOf <IEfMarvelCatalogDbContext>(db);
        }
        public void CreateCorrectlyRepository_WhenDbContextIsNotNull()
        {
            // Arrange
            var dbContext = new EfMarvelCatalogDbContext();

            // Act and Assert
            Assert.DoesNotThrow(() => new EfRepository <CharacterDataModel>(dbContext));
        }
        public void CreateCorrectlyCharacterService_IfEfRepositoryIsNotNull()
        {
            var dbContext  = new EfMarvelCatalogDbContext();
            var unitOfWork = new UnitOfwork(dbContext);
            var repository = new EfRepository <CharacterDataModel>(dbContext);

            Assert.DoesNotThrow(() => new CharacterService(unitOfWork, repository));
        }
        public void ShouldReturnInstanceOfICarsDbContext()
        {
            // Arrange
            var db = EfMarvelCatalogDbContext.Create();

            // Act & Assert
            Assert.IsInstanceOf <IEfMarvelCatalogDbContext>(db);
        }
Ejemplo n.º 5
0
        public void CreateInstanceOfDatabase()
        {
            // Arrange
            var db = new EfMarvelCatalogDbContext();

            // Act & Assert
            Assert.IsInstanceOf <EfMarvelCatalogDbContext>(db);
        }
        public void CreateCorrectlyUnitOfWork_WhenDbContextIsNotNull()
        {
            // Arrange
            var dbContext = new EfMarvelCatalogDbContext();

            // Act and Assert
            Assert.DoesNotThrow(() => new UnitOfwork(dbContext));
        }
        public void ThrowArgumentNullEcpetion_WhenIsPassedInvalidEfRepository()
        {
            // Arrange
            var dbContext  = new EfMarvelCatalogDbContext();
            var unitOfWork = new UnitOfwork(dbContext);

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new CharacterService(unitOfWork, null));
        }
        public void ThrowArgumentNullEcpetion_WhenIsPassedInvalidUnitOfWork()
        {
            // Arrange
            var dbContext  = new EfMarvelCatalogDbContext();
            var repository = new EfRepository <CharacterDataModel>(dbContext);

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new CharacterService(null, repository));
        }
        public void CreateInstance_OfTypeICharacterService()
        {
            var dbContext  = new EfMarvelCatalogDbContext();
            var unitOfWork = new UnitOfwork(dbContext);
            var repository = new EfRepository <CharacterDataModel>(dbContext);

            var characterService = new CharacterService(unitOfWork, repository);

            Assert.IsInstanceOf <ICharacterService>(characterService);
        }
        public void CreateInstance_OfTypeIEfRepository()
        {
            // Arrange
            var dbContext = new EfMarvelCatalogDbContext();

            // Act
            var unitOfWork = new EfRepository <CharacterDataModel>(dbContext);

            // Assert
            Assert.IsInstanceOf <IEfRepository <CharacterDataModel> >(unitOfWork);
        }
        public void CreateInstance_OfTypeIUnitOfWork()
        {
            // Arrange
            var dbContext = new EfMarvelCatalogDbContext();

            // Act
            var unitOfWork = new UnitOfwork(dbContext);

            // Assert
            Assert.IsInstanceOf <IUnitOfWork>(unitOfWork);
        }
Ejemplo n.º 12
0
        protected override void Seed(EfMarvelCatalogDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            //this.SeedUsers(context);
            //this.SeedSampleCharacters(context);
        }
Ejemplo n.º 13
0
 private void SeedSampleCharacters(EfMarvelCatalogDbContext context)
 {
 }
Ejemplo n.º 14
0
 private void SeedUsers(EfMarvelCatalogDbContext context)
 {
 }