Test_DB.cs

35 lines | 752 B Blame History Raw Download
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Model.UnitsOfWork;

namespace AppTests
{
    [TestClass]
    public class Test_DB
    {

        /// <summary>
        /// Проверка установки соединения с базой
        /// </summary>
        [TestMethod]
        public void TryConnect()
        {
            bool? exists;

            using (Context context = new Context())
            {
                context.Database.CreateIfNotExists();
                exists = context.Database.Exists();
            }

            Assert.IsTrue(exists.HasValue && exists.Value);
        }
    }
}