Beispiel #1
0
        public override void Before(MethodInfo methodUnderTest)
        {
            using var conn = new MySqlConnection(_connectionString);
            conn.OpenAsync().Wait();

            DbFixture.Reset(conn);
        }
Beispiel #2
0
        public FilmEntityTest(DbFixture fixture)
        {
            _context  = fixture.Context;
            _filmRepo = new FilmRepo(_context);

            DbTestData.SeedData(_context);
        }
 public IntegrationTests()
 {
     _dbFixture = new DbFixture();
     _dbFixture.AddEntity(2, 1, 2);
     _dbFixture.AddEntity(1, 2, 3);
     _dbFixture.AddEntity(3, 1, 1);
     _dbFixture.Context.SaveChanges();
 }
Beispiel #4
0
 public EntityFrameworkTests()
 {
     _dbFixture = new DbFixture();
     _dbFixture.AddEntity(2, 3);
     _dbFixture.AddEntity(1, 3);
     _dbFixture.AddEntity(1, 3);
     _dbFixture.Context.SaveChanges();
 }
Beispiel #5
0
        public UserTests(DbFixture <Startup> fixture)
        {
            _fixture = fixture;
            _client  = _fixture.CreateClient();

            GetUsersForTests();

            LoginUser();
        }
        public PostgreSQLKafkaSimpleSagaScenario(KafkaFixture kafkaFixture, DbFixture dbFixture)
        {
            _kafkaFixture = kafkaFixture;
            _dbFixture    = dbFixture;
            _topicName    = $"SQLKafkaSimpleSagaScenario.{Guid.NewGuid()}";

            var(_, connStr) = _dbFixture.CreateDbContext();
            _sqlConfig      = new SqlConfiguration(connStr);
        }
Beispiel #7
0
        public ThreadIntegrationTests(DbFixture <Startup> fixture)
        {
            _fixture = fixture;
            _client  = _fixture.CreateClient();

            var response = _client.GetAsync("api/threads").GetAwaiter().GetResult();

            threadList = JsonConvert.DeserializeObject <List <Thread> >(response.Content.ReadAsStringAsync().GetAwaiter().GetResult());

            LoginUser();
        }
Beispiel #8
0
        public MessageIntegrationTest(DbFixture <Startup> fixture)
        {
            _fixture = fixture;
            _client  = _fixture.CreateClient();

            var resp = _client.GetAsync("api/blogs").GetAwaiter().GetResult();

            blogList = JsonConvert.DeserializeObject <List <Blog> >(resp.Content.ReadAsStringAsync().GetAwaiter().GetResult());

            LoginUser();
        }
Beispiel #9
0
        public TestDb()
        {
            var connFact = new TestDbConnectionFactory();
            var db       = new DbFixture <TestDbConnectionFactory>(connFact);

            using var fs = File.OpenRead("schema.sql");
            using var sr = new StreamReader(fs);
            var sql = sr.ReadToEnd();

            db.Exec(sql);

            Db = db;
        }
Beispiel #10
0
        public void DuplicateName()
        {
            var CategoryService = DbFixture.GetRequiredService <CategoryService>();

            try
            {
                //Arrange 初始化
                string category_name = "熱血";
                //Act 行為
                var test = CategoryService.CreateCategory(category_name);
                //Assert 驗證結果
                Assert.True(test.Result == "已有相同名稱的分類", "測試通過");
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #11
0
        public void ArticleList()
        {
            var ArticleService = DbFixture.GetRequiredService <ArticleService>();

            try
            {
                //Arrange 初始化
                Guid catId = new Guid();
                //Act 行為
                var test = ArticleService.ArticleList(catId);
                //Assert 驗證結果
                Assert.True(test.Result != null, "測試通過");
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #12
0
        public void NoTitle()
        {
            var ArticleService = DbFixture.GetRequiredService <ArticleService>();

            try
            {
                //Arrange 初始化
                var para = new ArticleViewModel_para()
                {
                    category_id     = "6ca72fa3-c617-4a33-9ffd-3227c970dd60",
                    article_name    = "",
                    article_content = "空白"
                };
                //Act 行為
                var test = ArticleService.CreateArticle(para);
                //Assert 驗證結果
                Assert.True(test.Result == "文章名稱沒填", "測試通過");
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #13
0
        public GenreEntityTest(DbFixture fixture)
        {
            _context = fixture.Context;

            DbTestData.SeedData(_context);
        }
Beispiel #14
0
 public IntegrationTestWithDatabase()
 {
     dbFixture  = new DbFixture();
     factory    = new ApiWebApplicationFactory(ConfigureWebHostBuilder());
     httpClient = factory.CreateClient();
 }
Beispiel #15
0
 public ParticipantEntityTest(DbFixture fixture)
 {
     Options           = fixture.Options;
     using var context = new FilmContext(Options);
     DbTestData.SeedData(context);
 }
Beispiel #16
0
 public override void Before(MethodInfo methodUnderTest)
 {
     DbFixture.Reset(_connectionString);
 }
 public StrictModeEFTests()
 {
     _dbFixture = new DbFixture();
 }
 public PriceRepositoryTests(DbFixture dbFixture)
 {
     this.sut = new PriceRepository(dbFixture.AppDbContext);
 }
Beispiel #19
0
 public FilmsWithLangQueryTests(DbFixture dbFixture)
     : base(dbFixture)
 {
 }
Beispiel #20
0
 public DbBatchTests(TestDb testDb)
 {
     _testDb = testDb;
     _db     = testDb.Db;
 }
Beispiel #21
0
 public InsertActorsCommandTests(DbFixture dbFixture)
     : base(dbFixture)
 {
 }
Beispiel #22
0
 public FilmsWithActotsCatsQueryTests(DbFixture dbFixture)
     : base(dbFixture)
 {
 }
Beispiel #23
0
 public ActorsQueryTests(DbFixture dbFixture)
     : base(dbFixture)
 {
 }
 public SqlEventBroadcastingScenario(DbFixture dbFixture, RabbitFixture rabbitFixture)
 {
     _dbFixture     = dbFixture;
     _exchangeName  = $"{nameof(DummyEvent)}.{Guid.NewGuid()}";
     _rabbitFixture = rabbitFixture;
 }
Beispiel #25
0
 public DbFixtureTests(TestDb testDb)
 {
     _testDb = testDb;
     _db     = testDb.Db;
 }
Beispiel #26
0
 public ResultsEndpointTests(IntegrationFixture integrationFixture, DbFixture dbFixture)
 {
     this.integrationFixture = integrationFixture;
     this.dbFixture          = dbFixture;
 }
 public PostgreSQLKafkaEventBroadcastingScenario(KafkaFixture kafkaFixture, DbFixture dbFixture)
 {
     _kafkaFixture = kafkaFixture;
     _dbFixture    = dbFixture;
 }