1. Download SQL Server Express
2. Download Microsoft SQL Server Management Studio
3. On SQL Express window click on Connect now button.
or
in cmd type sqlcmd -S <ComputerName>
As result sqlcmd window will be opend
type create database NewDB
4. type go
5. type use NewDB
6. type go
7. type create table NewTable ( columnname1 columntype1, columnname2 columntype2)
8. type go
9. In Management Studio click on File/Connect Object Explorer
type server name and authentication
If DB created locally you can find server name on the tpo of sqlcmd
If DB created locally authentification will be Windows Authentification
10. in Visual Studio Tools/Connect to Database type server name and authentication
пʼятниця, 19 серпня 2016 р.
четвер, 18 серпня 2016 р.
How set/get data to cache c#
1. create helper class
public static class CacheHelper
{
static readonly ObjectCache Cache = MemoryCache.Default;
public static void SaveTocache(string cacheKey, object savedItem, DateTime absoluteExpiration)
{
MemoryCache.Default.Set(cacheKey, savedItem, absoluteExpiration);
}
public static T GetFromCache<T>(string cacheKey) where T : class
{
return MemoryCache.Default[cacheKey] as T;
}
public static void RemoveFromCache(string cacheKey)
{
MemoryCache.Default.Remove(cacheKey);
}
public static bool IsIncache(string cacheKey)
{
return MemoryCache.Default[cacheKey] != null;
}
public static T Get<T>(string cacheKey, string regionName = null) where T : class
{
return MemoryCache.Default.Get(cacheKey) as T;
}
/// <summary>
/// Gets all cached items as a list by their key.
/// </summary>
/// <returns></returns>
public static List<string> GetAll()
{
return Cache.Select(keyValuePair => keyValuePair.Key).ToList();
}
}
2. in base class add
/// <summary>
/// The general test clean.
/// </summary>
[TestCleanup]
public void GeneralTestClean()
{
this.TestContextWithTimer.EndTimer(TestName);
//Create a custom Timeout of 10 seconds
DateTime customTimeout = DateTime.Now.AddSeconds(60.0);
testDetailed.TestName = TestName;
testDetailed.Date = DateTime.Now;
testDetailed.Duration = this.TestContextWithTimer.TestDuration(testName).ToString();
testDetailed.PassFail = (Microsoft.VisualStudio.TestTools.UnitTesting.UnitTestOutcome.Passed == this.TestContext.CurrentTestOutcome ? "Pass" : "Fail");
result.Add(testDetailed);
CacheHelper.SaveTocache(CacheKeyValue, result, customTimeout);
//get list of keys
List<string> getCacheKeyList = CacheHelper.GetAll();
getCacheValueList = new Dictionary<string, List<string>>();
foreach (var item in getCacheKeyList)
{
var getCacheValueFromCache = CacheHelper.GetFromCache<List<string>>(item);
getCacheValueList.Add(item, getCacheValueFromCache);
}
this.client.Dispose();
}
private readonly string CacheKeyValue = "TestResultDetails " + DateTime.Now;
private static Dictionary<string, List<string>> getCacheValueList;
private static List<TestDetailed> endResult = new List<TestDetailed>();
[AssemblyCleanup]
public static void ClassCleanup()
{
foreach (string key in getCacheValueList.Keys)
{
foreach (string val in getCacheValueList[key])
{
Console.WriteLine(val);
}
}
}
public static class CacheHelper
{
static readonly ObjectCache Cache = MemoryCache.Default;
public static void SaveTocache(string cacheKey, object savedItem, DateTime absoluteExpiration)
{
MemoryCache.Default.Set(cacheKey, savedItem, absoluteExpiration);
}
public static T GetFromCache<T>(string cacheKey) where T : class
{
return MemoryCache.Default[cacheKey] as T;
}
public static void RemoveFromCache(string cacheKey)
{
MemoryCache.Default.Remove(cacheKey);
}
public static bool IsIncache(string cacheKey)
{
return MemoryCache.Default[cacheKey] != null;
}
public static T Get<T>(string cacheKey, string regionName = null) where T : class
{
return MemoryCache.Default.Get(cacheKey) as T;
}
/// <summary>
/// Gets all cached items as a list by their key.
/// </summary>
/// <returns></returns>
public static List<string> GetAll()
{
return Cache.Select(keyValuePair => keyValuePair.Key).ToList();
}
}
2. in base class add
/// <summary>
/// The general test clean.
/// </summary>
[TestCleanup]
public void GeneralTestClean()
{
this.TestContextWithTimer.EndTimer(TestName);
//Create a custom Timeout of 10 seconds
DateTime customTimeout = DateTime.Now.AddSeconds(60.0);
testDetailed.TestName = TestName;
testDetailed.Date = DateTime.Now;
testDetailed.Duration = this.TestContextWithTimer.TestDuration(testName).ToString();
testDetailed.PassFail = (Microsoft.VisualStudio.TestTools.UnitTesting.UnitTestOutcome.Passed == this.TestContext.CurrentTestOutcome ? "Pass" : "Fail");
result.Add(testDetailed);
CacheHelper.SaveTocache(CacheKeyValue, result, customTimeout);
//get list of keys
List<string> getCacheKeyList = CacheHelper.GetAll();
getCacheValueList = new Dictionary<string, List<string>>();
foreach (var item in getCacheKeyList)
{
var getCacheValueFromCache = CacheHelper.GetFromCache<List<string>>(item);
getCacheValueList.Add(item, getCacheValueFromCache);
}
this.client.Dispose();
}
private readonly string CacheKeyValue = "TestResultDetails " + DateTime.Now;
private static Dictionary<string, List<string>> getCacheValueList;
private static List<TestDetailed> endResult = new List<TestDetailed>();
[AssemblyCleanup]
public static void ClassCleanup()
{
foreach (string key in getCacheValueList.Keys)
{
foreach (string val in getCacheValueList[key])
{
Console.WriteLine(val);
}
}
}
середа, 13 липня 2016 р.
Івенти
- Событие, это ситуация, при возникновении которой, произойдут некоторые действия. Само событие имеет определенную структуру
- https://habrahabr.ru/post/213809/
Делегати
- делегат - это класс, содержащий данные о сигнатуре метода
- delegate string MyDelegate(int x)
- http://metanit.com/sharp/tutorial/3.13.php
четвер, 23 червня 2016 р.
Test Reports with Visual Studio, NUnit and Allure
- Firstly we need to download and install NUnit: www.NUnit.org
- Secondly we need the Allure NUnit adaptor, follow instructions here: Allure Framework Adaptor for NUnit
- The Allure Command Line Interface is needed, get it from here: Allure CLI
- Java JDK needs to be installed and specified correctly in your JAVE_HOME variable in your environment
вівторок, 23 лютого 2016 р.
Git: main commands
1. git status
Основной инструмент, используемый для определения, какие файлы в каком состоянии находятся
2. git add
Для того чтобы начать отслеживать (добавить под версионный контроль) новый файл, используется команда
3. git commit
Основной инструмент, используемый для определения, какие файлы в каком состоянии находятся
2. git add
Для того чтобы начать отслеживать (добавить под версионный контроль) новый файл, используется команда
3. git commit
четвер, 11 лютого 2016 р.
Spring: questions
1. What are the main Spring features?
- AOP support
- Lightweight framework
- container
- Inversion of control implementation
Підписатися на:
Дописи (Atom)