Beispiel #1
0
        public void GetRandomEnumValue_InputWithExcludeList_ReturnsValueNotInExcludeList()
        {
            var randomizer = new Randomizer();
            var value      = randomizer.GetRandomEnumValue <SomeEnum>(new List <SomeEnum>(GetAll.ValuesOf <SomeEnum>().Skip(1)));

            Assert.AreEqual(SomeEnum.Value1, value);
        }
Beispiel #2
0
        public void GetRandomEnumValue_InputWithExcludeList_ReturnsValueNotInExcludeList()
        {
            var randomizer = new Randomizer();
            var value = randomizer.GetRandomEnumValue<SomeEnum>(new List<SomeEnum>(GetAll.ValuesOf<SomeEnum>().Skip(1)));

            Assert.AreEqual(SomeEnum.Value1, value);
        }
Beispiel #3
0
        public void GetRandomItem_ValidInput_ReturnsItemFromCollection()
        {
            var collection = new List<object>() {new object(),new object(),new object(),new object()};

            var randomizer = new Randomizer();
            var item = randomizer.GetRandomItem(collection);

            Assert.IsTrue(collection.Contains(item));
        }
Beispiel #4
0
        public void GetRandomCell_ValidInput_ReturnsCellFromMap()
        {
            var map = new Map<Cell>(5, 5);

            var randomizer = new Randomizer();
            var randomCell = randomizer.GetRandomCell(map);

            Assert.AreEqual(map.GetCell(randomCell.Row, randomCell.Column), randomCell);
        }
Beispiel #5
0
        public void GetRandomCell_EmptyMap_ReturnsNull()
        {
            var map = new Map<Cell>(0, 0);

            var randomizer = new Randomizer();
            var randomCell = randomizer.GetRandomCell(map);

            Assert.IsNull(randomCell);
        }
Beispiel #6
0
        public void GetRandomCell_EmptyMap_ReturnsNull()
        {
            var map = new Map <Cell>(0, 0);

            var randomizer = new Randomizer();
            var randomCell = randomizer.GetRandomCell(map);

            Assert.IsNull(randomCell);
        }
Beispiel #7
0
        public void GetRandomCell_ValidInput_ReturnsCellFromMap()
        {
            var map = new Map <Cell>(5, 5);

            var randomizer = new Randomizer();
            var randomCell = randomizer.GetRandomCell(map);

            Assert.AreEqual(map.GetCell(randomCell.Row, randomCell.Column), randomCell);
        }
Beispiel #8
0
        public void GetRandomItem_ValidInput_ReturnsItemFromCollection()
        {
            var collection = new List <object>()
            {
                new object(), new object(), new object(), new object()
            };

            var randomizer = new Randomizer();
            var item       = randomizer.GetRandomItem(collection);

            Assert.IsTrue(collection.Contains(item));
        }