public void SqlLocalDbProvider_CreateInstance_Creates_Instance() { // Arrange Helpers.EnsureLocalDBInstalled(); SqlLocalDbProvider target = new SqlLocalDbProvider(); // Act SqlLocalDbInstance result = target.CreateInstance(); // Assert Assert.IsNotNull(result, "CreateInstance() returned null."); Assert.IsNotNull(result.Name, "SqlLocalDbInstance.Name is null."); try { ISqlLocalDbInstanceInfo info = result.GetInstanceInfo(); Assert.IsNotNull(info, "GetInstanceInfo() returned null."); Assert.IsTrue(info.Exists, "ISqlLocalDbInstanceInfo.Exists is incorrect."); Assert.IsFalse(info.IsRunning, "ISqlLocalDbInstanceInfo.IsRunning is incorrect."); Assert.AreEqual( new Version(target.Version).Major, info.LocalDbVersion.Major, "ISqlLocalDbInstanceInfo.LocalDbVersion is incorrect."); Assert.IsTrue(Guid.TryParse(result.Name, out Guid unused), "SqlLocalDbInstance.Name is not a valid GUID."); } finally { SqlLocalDbInstance.Delete(result); } }
public void SqlLocalDbProvider_GetInstance_Returns_Specified_Instance() { // Arrange Helpers.EnsureLocalDBInstalled(); SqlLocalDbProvider target = new SqlLocalDbProvider(); string instanceName = Guid.NewGuid().ToString(); // Act SqlLocalDbApi.CreateInstance(instanceName); try { // Assert SqlLocalDbInstance result = target.GetInstance(instanceName); Assert.IsNotNull(result, "CreateInstance() returned null."); Assert.AreEqual(instanceName, result.Name, "SqlLocalDbInstance.Name is incorrect."); ISqlLocalDbInstanceInfo info = result.GetInstanceInfo(); Assert.IsTrue(info.Exists, "ISqlLocalDbInstanceInfo.Exists is incorrect."); Assert.IsFalse(info.IsRunning, "ISqlLocalDbInstanceInfo.IsRunning is incorrect."); Assert.IsTrue(Guid.TryParse(result.Name, out Guid unused), "SqlLocalDbInstance.Name is not a valid GUID."); } finally { SqlLocalDbApi.DeleteInstance(instanceName); } }
public void SqlLocalDbProvider_CreateInstance_Creates_Instance_With_Specified_Name() { // Arrange Helpers.EnsureLocalDBInstalled(); SqlLocalDbProvider target = new SqlLocalDbProvider(); string instanceName = Guid.NewGuid().ToString(); // Act SqlLocalDbInstance result = target.CreateInstance(instanceName); // Assert Assert.IsNotNull(result, "CreateInstance() returned null."); Assert.AreEqual(instanceName, result.Name, "SqlLocalDbInstance.Name is incorrect."); try { ISqlLocalDbInstanceInfo info = result.GetInstanceInfo(); Assert.IsNotNull(info, "GetInstanceInfo() returned null."); Assert.IsTrue(info.Exists, "ISqlLocalDbInstanceInfo.Exists is incorrect."); Assert.IsFalse(info.IsRunning, "ISqlLocalDbInstanceInfo.IsRunning is incorrect."); Assert.AreEqual( new Version(target.Version).Major, info.LocalDbVersion.Major, "ISqlLocalDbInstanceInfo.LocalDbVersion is incorrect."); } finally { SqlLocalDbInstance.Delete(result); } }
public void SqlLocalDbInstance_GetInstanceInfo_Returns_Information_For_The_Specified_Instance() { // Arrange Helpers.EnsureLocalDBInstalled(); string instanceName = Guid.NewGuid().ToString(); SqlLocalDbApi.CreateInstance(instanceName); ISqlLocalDbInstanceInfo expected = SqlLocalDbApi.GetInstanceInfo(instanceName); try { SqlLocalDbInstance target = new SqlLocalDbInstance(instanceName); // Act ISqlLocalDbInstanceInfo result = target.GetInstanceInfo(); // Assert Assert.IsNotNull(result, "GetInstanceInfo() returned null."); Assert.AreEqual(expected.ConfigurationCorrupt, result.ConfigurationCorrupt, "ISqlLocalDbInstanceInfo. is incorrect."); Assert.AreEqual(expected.Exists, result.Exists, "ISqlLocalDbInstanceInfo.Exists is incorrect."); Assert.AreEqual(expected.IsAutomatic, result.IsAutomatic, "ISqlLocalDbInstanceInfo.IsAutomatic is incorrect."); Assert.AreEqual(expected.IsRunning, result.IsRunning, "ISqlLocalDbInstanceInfo.IsRunning is incorrect."); Assert.AreEqual(expected.IsShared, result.IsShared, "ISqlLocalDbInstanceInfo.IsShared is incorrect."); Assert.AreEqual(expected.LastStartTimeUtc, result.LastStartTimeUtc, "ISqlLocalDbInstanceInfo.LastStartTimeUtc is incorrect."); Assert.AreEqual(expected.LocalDbVersion, result.LocalDbVersion, "ISqlLocalDbInstanceInfo.LocalDbVersion is incorrect."); Assert.AreEqual(expected.Name, result.Name, "ISqlLocalDbInstanceInfo.Name is incorrect."); Assert.AreEqual(expected.NamedPipe, result.NamedPipe, "ISqlLocalDbInstanceInfo.NamedPipe is incorrect."); Assert.AreEqual(expected.OwnerSid, result.OwnerSid, "ISqlLocalDbInstanceInfo.OwnerSid is incorrect."); Assert.AreEqual(expected.SharedName, result.SharedName, "ISqlLocalDbInstanceInfo.SharedName is incorrect."); } finally { SqlLocalDbApi.DeleteInstance(instanceName); } }