public void Nothingから値を取り出そうとするとNullReferenceExceptionが送出されること() { var nothing = new Nothing<int>(); var value = 0; Assert.Throws<NullReferenceException>(() => value = nothing.Value); Assert.Throws<NullReferenceException>(() => Maybe<int>.FromJust(nothing)); }
protected override void _Start() { grid.ResetTiles(); Process p = new Nothing(); int i = 0; foreach( Unit unit in allUnits ) { if( !subjectUnit.team.IsAlly( unit ) && targetType == TargetType.Ally ) continue; if( !subjectUnit.team.IsEnemy( unit ) && targetType == TargetType.Enemy ) continue; if( onlyVisible && !subjectUnit.CanSee( unit.currentTile ) ) continue; unit.currentTile.MakeSelectable(); unit.collider.enabled = true; SelectionManager.MarkTargetable( unit ); i++; } print( i + " targetable units found." ); End(); }
protected override void _Start() { Process p = new Nothing(); processManager.AddImmediately( p ); p = path.Aggregate( p , ( current , tile ) => current.Enqueue( new UnitMoveToTile( subjectUnit , tile ) ) ); p.eventEnded += End; subjectUnit.model.animator.moving = true; }
public void NothingShouldBindToNothing() { var nothing = new Nothing<int>(); Assert.IsType<Nothing<int>>(nothing.Bind(x => (x + 1).ToMaybe())); }
public void NothingShouldReturnDefaultValue() { var nothing = new Nothing<string>(); Assert.Null(nothing.Return()); }
public void Nothing_FMap_ReturnsNothing() { var nothing = new Nothing<int>(); var result = nothing.FMap<string>(a => a.ToString()); Assert.IsInstanceOf<Nothing<string>>(result); }
public void Nothing_Bind_ReturnsNothing() { var nothing = new Nothing<string>(); var result = nothing.Bind<string>(a => new Just<string>(a)); Assert.IsInstanceOf<Nothing<string>>(result); }
static Maybe<Distance> Distance(Nothing<Location> a, Nothing<Location> b) { return new Nothing<Distance>(); }
public void TestMethod2() { ISomething something = new Something(); var tasks = new List<Task>(); var rwlock = new ReaderWriterLockSlim(); for (var i = 0; i < 100; i++) { // These threads should never see "nothing".... tasks.Add(Task.Run(() => { for (var x = 0; x < 1000000; x++) { rwlock.EnterReadLock(); try { Thread.Sleep(100); Assert.That(something.IsNothing, Is.False); } finally { rwlock.ExitReadLock(); } } })); } // ... even though this one keeps setting it to nothing tasks.Add(Task.Run(() => { for (var x = 0; x < 1000000; x++) { rwlock.EnterWriteLock(); try { something = new Nothing(); Thread.Sleep(100); something = new Something(); } finally { rwlock.ExitWriteLock(); } } })); Task.WhenAll(tasks).Wait(); }
protected override void _Start() { grid.ResetTiles(); Process p = new Nothing(); foreach( GridTile tile in grid.GetAllTiles() ) if( subjectUnit.CanSee( tile ) && tile.transform.position.IsInRange( subjectUnit.transform.position, range ) ) //if( subjectUnit.CanSee( tile ) && subjectUnit.GetDistance( tile ) < range ) tile.MakeSelectable(); End(); }