513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
|
|
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests;
|
|
|
|
public class NativeAlarmSourceSchemaTests
|
|
{
|
|
private static ScadaBridgeDbContext NewContext()
|
|
{
|
|
var opts = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
|
|
.UseSqlite("DataSource=:memory:")
|
|
.Options;
|
|
var ctx = new ScadaBridgeDbContext(opts);
|
|
ctx.Database.OpenConnection();
|
|
ctx.Database.EnsureCreated();
|
|
return ctx;
|
|
}
|
|
|
|
/// <summary>Verifies that a template native alarm source persists through its template.</summary>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
[Fact]
|
|
public async Task TemplateNativeAlarmSource_PersistsViaTemplate()
|
|
{
|
|
using var ctx = NewContext();
|
|
|
|
var t = new Template("T1");
|
|
t.NativeAlarmSources.Add(new TemplateNativeAlarmSource("Src1") { ConnectionName = "C", SourceReference = "r" });
|
|
ctx.Templates.Add(t);
|
|
await ctx.SaveChangesAsync();
|
|
|
|
Assert.Single(ctx.TemplateNativeAlarmSources);
|
|
}
|
|
|
|
/// <summary>Verifies that the instance native alarm source override DbSet is mapped.</summary>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
[Fact]
|
|
public async Task InstanceNativeAlarmSourceOverride_DbSetIsMapped()
|
|
{
|
|
using var ctx = NewContext();
|
|
Assert.Equal(0, await ctx.InstanceNativeAlarmSourceOverrides.CountAsync());
|
|
}
|
|
}
|