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 })); }
void IStage.Leave() { _Machine.Termination(); _Updater.Shutdown(); _DifferenceNoticer.Set(new IIndividual[0]); _DifferenceNoticer.JoinEvent -= this._BroadcastJoin; _DifferenceNoticer.LeftEvent -= this._BroadcastLeft; _Binder.Unbind <IEmotion>(this); _Binder.Unbind <IDevelopActor>(_Player); _Binder.Unbind <IPlayerProperys>(this); _Gate.Left(_Player); }