Exemple #1
0
 static WrapperTests()
 {
     LocalDbApi.StopAndDelete("WrapperTests");
     instance = new Wrapper(s => new SqlConnection(s), "WrapperTests", DirectoryFinder.Find("WrapperTests"));
     instance.Start(timestamp, TestDbBuilder.CreateTable);
     instance.AwaitStart().GetAwaiter().GetResult();
 }
Exemple #2
0
    public Task WithRebuild()
    {
        var instance2 = new Wrapper(s => new SqlConnection(s), "WrapperTests", DirectoryFinder.Find("WrapperTests"));

        instance2.Start(timestamp, connection => throw new Exception());
        return(instance2.AwaitStart());
    }
Exemple #3
0
    public async Task DefinedTimestamp()
    {
        var instance2 = new Wrapper(s => new SqlConnection(s), "DefinedTimestamp", DirectoryFinder.Find("DefinedTimestamp"));
        var dateTime  = DateTime.Now;

        instance2.Start(dateTime, connection => Task.CompletedTask);
        await instance2.AwaitStart();

        Assert.Equal(dateTime, File.GetCreationTime(instance2.TemplateDataFile));
    }
Exemple #4
0
    public async Task WithFileAndNoInstance()
    {
        var wrapper = new Wrapper("WithFileAndNoInstance", DirectoryFinder.Find("WithFileAndNoInstance"));

        wrapper.Start(timestamp, TestDbBuilder.CreateTable);
        await wrapper.AwaitStart();

        wrapper.DeleteInstance();
        wrapper = new Wrapper("WithFileAndNoInstance", DirectoryFinder.Find("WithFileAndNoInstance"));
        wrapper.Start(timestamp, TestDbBuilder.CreateTable);
        await wrapper.CreateDatabaseFromTemplate("Simple");

        ObjectApprover.Verify(await wrapper.ReadDatabaseState("Simple"));
        LocalDbApi.StopInstance("WithFileAndNoInstance");
    }
Exemple #5
0
    public async Task NoFileAndWithInstance()
    {
        LocalDbApi.StopAndDelete("NoFileAndWithInstance");
        LocalDbApi.CreateInstance("NoFileAndWithInstance");
        DirectoryFinder.Delete("NoFileAndWithInstance");
        var wrapper = new Wrapper(s => new SqlConnection(s), "NoFileAndWithInstance", DirectoryFinder.Find("NoFileAndWithInstance"));

        wrapper.Start(timestamp, TestDbBuilder.CreateTable);
        await wrapper.AwaitStart();

        await wrapper.CreateDatabaseFromTemplate("Simple");

        await Verify(await wrapper.ReadDatabaseState("Simple"));

        LocalDbApi.StopInstance("NoFileAndWithInstance");
    }