using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tools.SingletonTool.Base;
using Tools.SingletonTool.Manager;
namespace Test.SingletonTool
{
class SingleEntity : ISignlethonWithParams<SingleParams>
{
public string Name { set; get; }
public void SetParams(SingleParams param)
{
this.Name = param.name;
}
}
class SingleParams
{
public string name { set; get; }
}
[TestClass]
public class SingletonTest
{
[TestMethod]
public void Test1()
{
var sing = new SinglethonManager<SingleEntity>().Get;
}
[TestMethod]
public void Test2()
{
var sing = new SinglethonWithParamsManager<SingleEntity, SingleParams>(new SingleParams()
{
name = "Name"
}).Get;
if (sing.Name != "Name")
{
throw new Exception();
}
}
}
}