Exemplo n.º 1
0
        public void ItemLocationEnumHelper_GetLocationByPosition_2_Should_Pass()
        {
            // Arrange

            var value = 2;

            // Act
            var Actual   = ItemLocationEnumHelper.GetLocationByPosition(value);
            var Expected = ItemLocationEnum.Necklass;

            // Assert
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 2
0
        public void ItemLocationEnumHelperTests_GetItemFromLocationType_Necklace_Should_Pass()
        {
            // Arrange

            // Act
            var result = ItemLocationEnumHelper.GetItemFromLocationType(ItemLocationEnum.Necklace);

            // Reset

            // Assert
            Assert.AreEqual(result.Count, 3);
            Assert.Contains(ItemTypeEnum.LibraryCard, result);
            Assert.Contains(ItemTypeEnum.FoodCourtCard, result);
            Assert.Contains(ItemTypeEnum.PrivateTutor, result);
        }
Exemplo n.º 3
0
        public void ItemLocationEnumHelperTests_GetItemFromLocationType_PrimaryHand_Should_Pass()
        {
            // Arrange

            // Act
            var result = ItemLocationEnumHelper.GetItemFromLocationType(ItemLocationEnum.PrimaryHand);

            // Reset

            // Assert
            Assert.AreEqual(result.Count, 5);
            Assert.Contains(ItemTypeEnum.PencilEraser, result);
            Assert.Contains(ItemTypeEnum.Notebook, result);
            Assert.Contains(ItemTypeEnum.Textbooks, result);
            Assert.Contains(ItemTypeEnum.Laptop, result);
            Assert.Contains(ItemTypeEnum.Tuition, result);
        }
        public void ItemLocationEnumHelper_ConvertStringToEnum_Should_Pass()
        {
            // Arrange

            var myList = Enum.GetNames(typeof(ItemLocationEnum)).ToList();

            ItemLocationEnum myActual;
            ItemLocationEnum myExpected;

            // Act

            foreach (var item in myList)
            {
                myActual   = ItemLocationEnumHelper.ConvertStringToEnum(item);
                myExpected = (ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), item);

                // Assert
                Assert.AreEqual(myExpected, myActual, "string: " + item + TestContext.CurrentContext.Test.Name);
            }
        }
        /// <summary>
        /// Get a Random Item for the Location. This method it particular to the Escaping School game flavor.
        ///
        /// Return the String for the ID
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public static string GetItemEscapingSchool(ItemLocationEnum location)
        {
            var ItemList = new List <ItemModel>();

            // Add None to the list
            ItemList.Add(new ItemModel {
                Id = null, Name = "None"
            });

            var itemtypes = ItemLocationEnumHelper.GetItemFromLocationType(location);

            if (itemtypes.Count == 0)
            {
                return(null);
            }

            foreach (var type in itemtypes)
            {
                ItemModel item = new ItemModel();
                item.Name        = ItemTypeEnumHelper.getRandomeNameBasedOnType(type);
                item.Description = ItemTypeEnumHelper.getDescriptionBasedOnType(type);
                item.ItemType    = type;
                item.Attribute   = AttributeEnum.Attack;
                item.Location    = location;
                item.ImageURI    = ItemTypeEnumHelper.GetImageURIFromItemType(type);
                item.Damage      = ItemTypeEnumHelper.GetDamageFromItemType(type);
                ItemList.Add(item);
            }

            var result = ItemList.First().Id;

            var index = DiceHelper.RollDice(1, ItemList.Count()) - 1;

            if (index < ItemList.Count)
            {
                result = ItemList.ElementAt(index).Id;
            }

            return(result);
        }