public void DifferenceNoticerTestSetWithParam() { var joinResult = new List <int[]>(); var leftResult = new List <int[]>(); var before = new int[] { 1, 2, 3, 4, 5 }; var after = new int[] { 2, 3, 4, 5, 6 }; var differenceNoticer = new DifferenceNoticer <int>(new IntComparer()); differenceNoticer.JoinEvent += instances => { joinResult.Add(instances.ToArray()); }; differenceNoticer.LeftEvent += instances => { leftResult.Add(instances.ToArray()); }; differenceNoticer.Set(before); // j0 1 , 2 ,3 ,4 ,5 : l0 differenceNoticer.Set(after); // j1 6 : l1 1 var vertifyJoin = joinResult.ToArray(); var vertifyLeft = leftResult.ToArray(); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyJoin[0], new[] { 1, 2, 3, 4, 5 })); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyJoin[1], new[] { 6 })); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyLeft[1], new[] { 1 })); }
public void DifferenceNoticerTestSet() { List <int[]> joinResult = new List <int[]>(); List <int[]> leftResult = new List <int[]>(); int[] before = new int[] { 1, 2, 3, 4, 5 }; int[] after = new int[] { 2, 3, 4, 5, 6 }; DifferenceNoticer <int> differenceNoticer = new DifferenceNoticer <int>(); differenceNoticer.JoinEvent += instances => { joinResult.Add(instances.ToArray()); }; differenceNoticer.LeaveEvent += instances => { leftResult.Add(instances.ToArray()); }; differenceNoticer.Set(before); // j0 1 , 2 ,3 ,4 ,5 : l0 differenceNoticer.Set(after); // j1 6 : l1 1 int[][] vertifyJoin = joinResult.ToArray(); int[][] vertifyLeft = leftResult.ToArray(); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyJoin[0], new[] { 1, 2, 3, 4, 5 })); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyJoin[1], new[] { 6 })); NUnit.Framework.Assert.IsTrue(Regulus.Utility.ValueHelper.DeepEqual(vertifyLeft[1], new[] { 1 })); }
public GameStage(ISoulBinder binder, IMapFinder map, IMapGate gate, Entity entity) { _Gate = gate; _Map = map; _Binder = binder; _DeltaTimeCounter = new TimeCounter(); _UpdateTimeCounter = new TimeCounter(); _Updater = new Updater(); _Machine = new StageMachine(); _DifferenceNoticer = new DifferenceNoticer <IIndividual>(); _Player = entity; _Mover = new Mover(this._Player); }
public GameStage(ISoulBinder binder, IMapFinder map , IMapGate gate, Entity entity) { _Gate = gate; _Map = map; _Binder = binder; _DeltaTimeCounter = new TimeCounter(); _UpdateTimeCounter = new TimeCounter(); _Updater = new Updater(); _Machine = new StageMachine(); _DifferenceNoticer = new DifferenceNoticer<IIndividual>(); _Player = entity; _Mover = new Mover(this._Player); }