public static void AssemblyInitialize(TestContext context)
        {
            CurrentTestSettings = TestSettingProvider.GetSettings();
            DatabaseType        = TestSettingProvider.GetTestDatabaseType();

            if (DatabaseType.Equals("docker", StringComparison.OrdinalIgnoreCase))
            {
                // 取得 TestSettings 裡的 Docker 設定
                var containerSetting = TestSettingProvider.GetContainerSetting();
                var containerLabel   = CurrentTestSettings.ContainerLabel;

                CreateDockerContainer(containerSetting, containerLabel);
            }
            else
            {
                TestLocalDbProcess.CreateDatabase(TestDbConnections.LocalDb.Master, DatabaseName);
            }

            // FluentAssertions 設定 : 日期時間使用接近比對的方式,而非完全一致的比對
            AssertionOptions.AssertEquivalencyUsing(options =>
            {
                options.Using <DateTime>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation))
                .WhenTypeIs <DateTime>();

                return(options);
            });
        }
示例#2
0
 public static void AssemblyInitialize(TestContext context)
 {
     TestLocalDbProcess.CreateDatabase();
 }