SingletonTest.cs

48 lines | 933 B Blame History Raw Download
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Tools.SingletonTool;

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 = Signlethon<SingleEntity>.Get();

            
        }

        [TestMethod]
        public void Test2()
        {
            var sing = SignlethonWithParams<SingleEntity, SingleParams>.Create(new SingleParams()
            {
                name = "Name"
            });

            if (sing.Name != "Name")
                throw new Exception();
        }
    }
}