static TestEntities() { TestPlayer = new PlayerCharacter(-All.PlayerCharacterIDs.Minimum, "0", "Test Player", "Test", "Test"); TestCritter = new Critter(-All.CritterIDs.Minimum, "1 Test Critter", "Test", "Test", All.BiomeIDs.Minimum, Behavior.Still); TestNPC = new NPC(-All.NpcIDs.Minimum, "2", "Test NPC", "Test", "Test", All.BiomeIDs.Minimum, Behavior.Still); TestFloor = new Floor(-All.FloorIDs.Minimum, "3 Test Floor", "Test", "Test", in_addsToRoom: TestTag); TestBlock = new Block(-All.BlockIDs.Minimum, "4 Test Block", "Test", "Test", in_addsToRoom: TestTag); TestFurnishing = new Furnishing(-All.FurnishingIDs.Minimum, "5 Test Furnishing", "Test", "Test", in_isEntry: true, in_addsToRoom: TestTag); TestCollectible = new Collectible(-All.CollectibleIDs.Minimum, "6 Test Collectible", "Test", "Test", in_addsToRoom: TestTag); TestRoomRecipe = new RoomRecipe(-All.RoomRecipeIDs.Minimum - 1, "7 Test Room Recipe", "Test", "Test", TestRecipeElementList, All.Recipes.Rooms.MinWalkableSpaces + 1, TestRecipeElementList, TestRecipeElementList); TestCraftingRecipe = new CraftingRecipe(-All.CraftingRecipeIDs.Minimum, "8 Test Crafting Recipe", "Test", "Test", TestRecipeElementList, TestRecipeElementList, new StrikePanel[All.Dimensions.PanelsPerPatternHeight, All.Dimensions.PanelsPerPatternWidth]); //TestQuest = new Quest(-All.QuestIDs.Minimum, "9 Test Quest", "Test", "Test"); TestBiome = new Biome(-All.BiomeIDs.Minimum, "10 Test Biome", "Test", "Test", 1, Elevation.LevelGround, false, null, null); TestItem = new Item(-All.ItemIDs.Minimum, ItemType.Other, "11 Test Item", "Test", "Test", 1, 0, 99, 1, 1, -All.BlockIDs.Minimum); // Sets up All so that bounds can be checked in various constructors. Parquets = new List <ParquetParent> { TestFloor, TestBlock, TestFurnishing, TestCollectible }; All.InitializeCollections(Parquets); }
public void SaveAndLoadFurnishings() { var furnishing1 = EntityFactory.CreateFurnishing("TestFurnishing1", 3, 4, new Dictionary <string, string>()); var furnishing2 = EntityFactory.CreateFurnishing("TestFurnishing2", 5, 6, new Dictionary <string, string>()); var paramDict3 = new Dictionary <string, string> { { "InteractionTrap", "True" }, { "TrapType", "PoisonDart" }, { "TrapLevel", "3" } }; var furnishing3 = EntityFactory.CreateFurnishing("TestFurnishing1", 3, 4, paramDict3); Assert.AreEqual(1, furnishing1.FurnishingId); Assert.AreEqual(2, furnishing2.FurnishingId); Assert.AreEqual(3, furnishing3.FurnishingId); var saveData = Furnishing.GetSaveData(); Furnishing.LoadSaveData(saveData); var loadedFurnishing1 = Furnishing.GetFurnishing(1); var loadedFurnishing2 = Furnishing.GetFurnishing(2); var loadedFurnishing3 = Furnishing.GetFurnishing(3); Assert.AreEqual(furnishing1, loadedFurnishing1); Assert.AreEqual(furnishing2, loadedFurnishing2); Assert.AreEqual(furnishing3, loadedFurnishing3); }
public void Setup() { ErrorLogger.SetToTest(); Furnishing.ClearFurnishingIds(); StaticDatabase.StaticDatabaseConnection.SetToTest(databasePath); StaticDatabase.StaticDatabaseConnection.OpenDBConnection(); }
//Add a renatal property internal void ListARental() { //To skip the highlighted option SkipButton?.Click(); System.Threading.Thread.Sleep(5000); // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); OwnersSelect.Click(); System.Threading.Thread.Sleep(5000); PropertiesSelect.Click(); ListRental.Click(); //Value set for adding rental property SelectProperty.SendKeys(ExcelLib.ReadData(10, "RentalPropertyValue")); Title.SendKeys(ExcelLib.ReadData(2, "RentalPropertyValue")); MovingCost.SendKeys(ExcelLib.ReadData(3, "RentalPropertyValue")); RentalDescription.SendKeys(ExcelLib.ReadData(7, "RentalPropertyValue")); RentalTargetRent.SendKeys(ExcelLib.ReadData(4, "RentalPropertyValue")); Furnishing.SendKeys(ExcelLib.ReadData(8, "RentalPropertyValue")); AvailableDate.SendKeys(ExcelLib.ReadData(5, "RentalPropertyValue")); IdealTenant.SendKeys(ExcelLib.ReadData(9, "RentalPropertyValue")); Occupants.SendKeys(ExcelLib.ReadData(6, "RentalPropertyValue")); SaveRental.Click(); IAlert alert = Global.Driver.driver.SwitchTo().Alert(); alert.Accept(); }
/// <summary> /// Initializes a new instance of the <see cref="T:ParquetClassLibrary.Sandbox.Parquets.ParquetStack"/> struct. /// </summary> /// <param name="in_floor">The floor-layer parquet.</param> /// <param name="in_block">The The floor-layer parquet-layer parquet.</param> /// <param name="in_furnishing">The furnishing-layer parquet.</param> /// <param name="in_collectible">The collectible-layer parquet.</param> public ParquetStack(Floor in_floor, Block in_block, Furnishing in_furnishing, Collectible in_collectible) { Floor = in_floor; Block = in_block; Furnishing = in_furnishing; Collectible = in_collectible; }
public Level(LevelSaveSummary summary) { _levelId = summary.LevelId; _levelName = summary.LevelName; _mapWidth = summary.Width; _mapHeight = summary.Height; _tileInformation = new Dictionary <int, MapTileDetails>(); _tileGrid = summary.Tiles; foreach (KeyValuePair <int, TileType> tile in summary.TileTypes) { _tileInformation[tile.Key] = Entities.EntityFactory.CreateMapTile(tile.Value); } _revealed = summary.Revealed; _furnishings = new SortedDictionary <int, Furnishing>(); foreach (KeyValuePair <int, int> furnishing in summary.Furnishings) { _furnishings[furnishing.Key] = Furnishing.GetFurnishing(furnishing.Value); } _actors = new SortedDictionary <int, Actor>(); foreach (KeyValuePair <int, int> actor in summary.Actors) { _actors[actor.Key] = Actor.GetActor(actor.Value); } }
public void ValidItemIDsArePermittedTest() { EntityID goodItemID = -All.ItemIDs.Minimum; var testBlock = new Furnishing(newFurnishingID, "will be created", "", "", goodItemID); Assert.NotNull(testBlock); }
public void ValidSwapIDsArePermittedTest() { var goodSwapID = newFurnishingID - 1; var testBlock = new Furnishing(newFurnishingID, "will be created", "", "", in_swapID: goodSwapID); Assert.NotNull(testBlock); }
void AddFurnishing(Furnishing furnishing, int index) { if (_furnishings.ContainsKey(index)) { // TODO: Add error text here } _furnishings[index] = furnishing; }
/// <summary> /// Gets any furnishing parquet at the position. /// </summary> /// <param name="in_position">The position whose furnishing is sought.</param> /// <returns>The furnishing at the given position, or <c>null</c> if there is none.</returns> public Furnishing GetFurnishingAtPosition(Vector2Int in_position) { Furnishing result = null; if (IsValidPosition(in_position)) { result = AllParquets.Get <Furnishing>(_furnishingLayer[in_position.X, in_position.Y]); } return(result); }
public void InvalidItemIDsRaiseExceptionTest() { var badItemID = TestParquets.TestBlock.ID; void TestCode() { var _ = new Furnishing(newFurnishingID, "will fail", in_itemID: badItemID); } Assert.Throws <ArgumentOutOfRangeException>(TestCode); }
public void InvalidSwapIDsRaiseExceptionTest() { var badSwapID = TestEntities.TestBlock.ID; void TestCode() { var _ = new Furnishing(newFurnishingID, "will fail", "", "", in_swapID: badSwapID); } Assert.Throws <ArgumentOutOfRangeException>(TestCode); }
public void InvalidCollectibleIDsRaiseExceptionTest() { var badFurnishingID = TestEntities.TestBlock.ID; void TestCode() { var _ = new Furnishing(badFurnishingID, "will fail", "", ""); } Assert.Throws <ArgumentOutOfRangeException>(TestCode); }
void RemoveFurnishing(Furnishing furnishing, int index) { if (_furnishings.ContainsKey(index)) { if (_furnishings[index] == furnishing) { _furnishings.Remove(index); } else { // TODO: Add error text. } } else { // TODO: Add error text } }
public void TestFurnishingIds() { var furnishing1 = EntityFactory.CreateFurnishing("TestFurnishing1", 3, 4, new Dictionary <string, string>()); var furnishing2 = EntityFactory.CreateFurnishing("TestFurnishing2", 5, 6, new Dictionary <string, string>()); var paramDict3 = new Dictionary <string, string> { { "InteractionTrap", "True" }, { "TrapType", "PoisonDart" }, { "TrapLevel", "3" } }; var furnishing3 = EntityFactory.CreateFurnishing("TestFurnishing1", 3, 4, paramDict3); Assert.AreEqual(1, furnishing1.FurnishingId); Assert.AreEqual(2, furnishing2.FurnishingId); Assert.AreEqual(3, furnishing3.FurnishingId); Assert.AreEqual(furnishing1, Furnishing.GetFurnishing(1)); Assert.AreEqual(furnishing2, Furnishing.GetFurnishing(2)); Assert.AreEqual(furnishing3, Furnishing.GetFurnishing(3)); furnishing2.Dispose(); ErrorLogger.ClearTestMessages(); Assert.IsNull(Furnishing.GetFurnishing(2)); Assert.AreEqual("Tried to get unknown furnishing id: 2", ErrorLogger.GetNextTestMessage()); furnishing1.Dispose(); ErrorLogger.ClearTestMessages(); Assert.IsNull(Furnishing.GetFurnishing(1)); Assert.AreEqual("Tried to get unknown furnishing id: 1", ErrorLogger.GetNextTestMessage()); var furnishing4 = EntityFactory.CreateFurnishing("TestFurnishing1", 3, 5, new Dictionary <string, string>()); Assert.AreEqual(2, furnishing4.FurnishingId); var furnishing5 = EntityFactory.CreateFurnishing("TestFurnishing2", 1, 2, new Dictionary <string, string>()); Assert.AreEqual(1, furnishing5.FurnishingId); }
public void TestDistance() { Assert.AreEqual(5, DistanceFunctions.Distance(0, 0, 3, 4)); Assert.AreEqual(9, DistanceFunctions.Distance(4, 0, 10, 7)); Assert.AreEqual(15, DistanceFunctions.Distance(10, 20, 20, 32)); var details = new FurnishingDetails("Test", ' ', "Test", "", Entities.Material.Immune, new List <Entities.Trait>()); var e1 = new Furnishing(details, 0, 0, new Dictionary <string, string>()); var e2 = new Furnishing(details, 4, 3, new Dictionary <string, string>()); Assert.AreEqual(5, DistanceFunctions.Distance(e1, e2)); e1 = new Furnishing(details, 4, 0, new Dictionary <string, string>()); e2 = new Furnishing(details, 10, 7, new Dictionary <string, string>()); Assert.AreEqual(9, DistanceFunctions.Distance(e1, e2)); e1 = new Furnishing(details, 10, 20, new Dictionary <string, string>()); e2 = new Furnishing(details, 20, 32, new Dictionary <string, string>()); Assert.AreEqual(15, DistanceFunctions.Distance(e1, e2)); e1 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); e2 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); Assert.AreEqual(0, DistanceFunctions.Distance(e1, e2)); }
public void TestDistanceSquared() { Assert.AreEqual(25, DistanceFunctions.DistanceSquared(0, 0, 3, 4)); Assert.AreEqual(85, DistanceFunctions.DistanceSquared(4, 0, 10, 7)); Assert.AreEqual(244, DistanceFunctions.DistanceSquared(10, 20, 20, 32)); var details = new FurnishingDetails("Test", ' ', "Test", new List <Entities.Trait>()); var e1 = new Furnishing(details, 0, 0, new Dictionary <string, string>()); var e2 = new Furnishing(details, 4, 3, new Dictionary <string, string>()); Assert.AreEqual(25, DistanceFunctions.DistanceSquared(e1, e2)); e1 = new Furnishing(details, 4, 0, new Dictionary <string, string>()); e2 = new Furnishing(details, 10, 7, new Dictionary <string, string>()); Assert.AreEqual(85, DistanceFunctions.DistanceSquared(e1, e2)); e1 = new Furnishing(details, 10, 20, new Dictionary <string, string>()); e2 = new Furnishing(details, 20, 32, new Dictionary <string, string>()); Assert.AreEqual(244, DistanceFunctions.DistanceSquared(e1, e2)); e1 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); e2 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); Assert.AreEqual(0, DistanceFunctions.DistanceSquared(e1, e2)); }
public void TestManhattanDistance() { Assert.AreEqual(7, DistanceFunctions.ManhattanDistance(0, 0, 3, 4)); Assert.AreEqual(13, DistanceFunctions.ManhattanDistance(4, 0, 10, 7)); Assert.AreEqual(22, DistanceFunctions.ManhattanDistance(10, 20, 20, 32)); var details = new FurnishingDetails("Test", ' ', "Test", new List <Entities.Trait>()); var e1 = new Furnishing(details, 0, 0, new Dictionary <string, string>()); var e2 = new Furnishing(details, 4, 3, new Dictionary <string, string>()); Assert.AreEqual(7, DistanceFunctions.ManhattanDistance(e1, e2)); e1 = new Furnishing(details, 4, 0, new Dictionary <string, string>()); e2 = new Furnishing(details, 10, 7, new Dictionary <string, string>()); Assert.AreEqual(13, DistanceFunctions.ManhattanDistance(e1, e2)); e1 = new Furnishing(details, 10, 20, new Dictionary <string, string>()); e2 = new Furnishing(details, 20, 32, new Dictionary <string, string>()); Assert.AreEqual(22, DistanceFunctions.ManhattanDistance(e1, e2)); e1 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); e2 = new Furnishing(details, 9, 7, new Dictionary <string, string>()); Assert.AreEqual(0, DistanceFunctions.ManhattanDistance(e1, e2)); }
public void RemoveFurnishing(Furnishing furnishing) { RemoveFurnishing(furnishing, furnishing.XLoc, furnishing.YLoc); }
public void AddFurnishing(Furnishing furnishing) { AddFurnishing(furnishing, furnishing.XLoc, furnishing.YLoc); }
public void RemoveFurnishing(Furnishing furnishing, int xLoc, int yLoc) { var index = ConvertXYToInt(xLoc, yLoc); RemoveFurnishing(furnishing, index); }
public void ValidCollectibleIDsArePermittedTest() { var testFurnishing = new Furnishing(newFurnishingID, "will be created", "", ""); Assert.NotNull(testFurnishing); }