public void Build() { var structureSchemas = new StructureSchemas(new StructureTypeFactory(), new AutoStructureSchemaBuilder()); structureSchemas.GetSchema <MyDummy>(); var dbFake = new Mock <ISisoDatabase>(); dbFake.SetupGet(f => f.Name).Returns("UnitTestDb"); dbFake.Setup(f => f.ConnectionInfo).Returns(new Sql2012ConnectionInfo("data source=.;initial catalog=foo;integrated security=true;")); dbFake.Setup(f => f.Settings).Returns(DbSettings.CreateDefault()); dbFake.Setup(f => f.Serializer).Returns(new ServiceStackSisoSerializer()); dbFake.Setup(f => f.StructureSchemas).Returns(structureSchemas); var dbDiagnostics = new DbDiagnosticsBuilder(dbFake.Object); var info = dbDiagnostics.Build(); JsonApprovals.VerifyAsJson(info); }
public void GetData() { var structureSchemas = new StructureSchemas(new StructureTypeFactory(), new AutoStructureSchemaBuilder()); structureSchemas.GetSchema <MyDummy>(); var dbFake = new Mock <ISisoDatabase>(); dbFake.SetupGet(f => f.Name).Returns("UnitTestDb"); dbFake.Setup(f => f.ConnectionInfo).Returns(new Sql2012ConnectionInfo("data source=.;initial catalog=foo;integrated security=true;")); dbFake.Setup(f => f.Settings).Returns(DbSettings.CreateDefault()); dbFake.Setup(f => f.Serializer).Returns(new ServiceStackSisoSerializer()); dbFake.Setup(f => f.StructureSchemas).Returns(structureSchemas); SisoDbGlimpsePlugin.ResolveDatabasesUsing = () => new[] { dbFake.Object }; var plugin = new SisoDbGlimpsePlugin(); var data = plugin.GetData(Mock.Of <ITabContext>()); JsonApprovals.VerifyAsJson(data); }