Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
CreepyTowers.Tests.Towers TowerTests
Namespace: CreepyTowers.Tests.Towers
Assembly: CreepyTowers.Tests (in CreepyTowers.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TowerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TowerTests | Initializes a new instance of the TowerTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void NotInitializingTowerDoesntCreateTowerModel() { new Tower(TowerType.Water, Vector3D.Zero); Assert.AreEqual(0, EntitiesRunner.Current.GetEntitiesOfType<Model>().Count); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Tower>().Count); }
[Test, CloseAfterFirstFrame] public void InitializingTowerCreatesTowerModel() { var tower = new Tower(TowerType.Water, Vector3D.Zero); tower.RenderModel(); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Model>().Count); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Tower>().Count); }
[Test] public void DisplayWaterTower() { var tower = new Tower(TowerType.Water, Vector3D.Zero, 170.0f); tower.RenderModel(); }
[Test] public void DisplayAcidTower() { var tower = new Tower(TowerType.Acid, Vector3D.Zero, 120.0f); tower.RenderModel(); }
[Test] public void DisplayFireTower() { var tower = new Tower(TowerType.Fire, Vector3D.Zero, 150.0f); tower.RenderModel(); }
[Test] public void DisplayIceTower() { var tower = new Tower(TowerType.Ice, Vector3D.Zero, 160.0f); tower.RenderModel(); }
[Test] public void DisplayImpactTower() { var tower = new Tower(TowerType.Impact, Vector3D.Zero, 120.0f); tower.RenderModel(); }
[Test] public void DisplaySliceTower() { var tower = new Tower(TowerType.Slice, Vector3D.Zero, 120.0f); tower.RenderModel(); }
[Test] public void DisplayAndDisposeTower() { var tower = new Tower(TowerType.Water, Vector3D.Zero, 170.0f); tower.RenderModel(); tower.Dispose(); Assert.AreEqual(0, EntitiesRunner.Current.GetEntitiesOfType<Tower>().Count); }
[Test] public void CreateTowerAtClickedPosition() { var floor = new Plane(Vector3D.UnitY, 0.0f); new Command(pos => { //ncrunch: no coverage start var ray = Camera.Current.ScreenPointToRay(ScreenSpace.Current.ToPixelSpace(pos)); var position = floor.Intersect(ray).Value; new Tower(TowerType.Water, position); //ncrunch: no coverage end }).Add(new MouseButtonTrigger(MouseButton.Left, State.Releasing)); }
[Test, CloseAfterFirstFrame] public void DisposingTowerRemovesTowerEntity() { var tower = new Tower(TowerType.Water, Vector3D.Zero); tower.Dispose(); Assert.IsFalse(tower.IsActive); }
[Test] public void ShowTowerFiringAtCreepAtRegularIntervals() { camera.ZoomLevel = 1 / 20.0f; var tower = new Tower(TowerType.Water, new Vector2D(0, 0)); var creep = new Creep(CreepType.Cloth, new Vector2D(2, 0)); tower.RenderModel(); creep.RenderModel(); new TowerTargetFinder(); }
[Test, CloseAfterFirstFrame] public void CheckForCreepUnderAttack() { var tower = new Tower(TowerType.Slice, new Vector2D(0, 0)); tower.RenderModel(); var creep = new Creep(CreepType.Cloth, new Vector2D(1, 0)); new TowerTargetFinder(); AdvanceTimeAndUpdateEntities(2.1f); Assert.Less(creep.GetStatPercentage("Hp"), 1); }
[Test] public void ShowTowerFiringAtAMovingCreep() { camera.ZoomLevel = 1 / 20.0f; var tower = new Tower(TowerType.Water, new Vector2D(0, 0)); var creep = new Creep(CreepType.Cloth, new Vector2D(1, 3)); creep.Path = new List<Vector2D> { (new Vector2D(1, -10)) }; tower.RenderModel(); creep.RenderModel(); new TowerTargetFinder(); }
[Test] public void ShowAllTowerTypesAndEffects() { var tower = new Tower(TowerType.Acid, Vector3D.Zero); tower.RenderModel(); var creep = new Creep(CreepType.Cloth, new Vector2D(2, 8)); new Command(() => { tower.FireAtCreep(creep); }).Add(new KeyTrigger(Key.Space)); new Command(() => { tower.RotationZ += 2; }).Add(new KeyTrigger(Key.A, State.Pressed)); new Command(() => { tower.RotationZ -= 2; }).Add(new KeyTrigger(Key.D, State.Pressed)); new Command(() => { //ncrunch: no coverage start tower.Dispose(); tower = new Tower(CycleTypeUpwards(tower.Type), Vector3D.Zero); tower.RenderModel(); //ncrunch: no coverage end }).Add(new KeyTrigger(Key.W)); new Command(() => { //ncrunch: no coverage start tower.Dispose(); tower = new Tower(CycleTypeDownwards(tower.Type), Vector3D.Zero); tower.RenderModel(); //ncrunch: no coverage end }).Add(new KeyTrigger(Key.S)); }
[Test] public void ShowWaterTowerWithSunlightEnabled() { new Player(); Camera.Current.Position = new Vector3D(0.0f, -4.0f, 2.0f); var tower = new Tower(TowerType.Water, Vector3D.Zero); tower.RenderModel(); }
See Also