public void TestIsInUseNormal()
        {
            Mock<IDifficultyLevelDao> difficultyLevelDaoMock = new Mock<IDifficultyLevelDao>();
            difficultyLevelDaoMock.Setup(x => x.IsInUse(It.IsAny<DifficultyLevel>())).Returns(true);

            DifficultyLevel difficultyLevel = new DifficultyLevel();
            IDifficultyLevelService difficultyLevelService = new DifficultyLevelService(difficultyLevelDaoMock.Object);
            bool isInUse = difficultyLevelService.IsInUse(difficultyLevel);

            difficultyLevelDaoMock.Verify(x=>x.IsInUse(difficultyLevel), Times.Once);
            Assert.IsTrue(isInUse);
        }
        public void TestGetAll()
        {
            Mock<IDifficultyLevelDao> levelDaoMock = new Mock<IDifficultyLevelDao>();
            levelDaoMock.Setup(x => x.GetAllIn(It.IsAny<DifficultyLevelScale>())).Returns(new List<DifficultyLevel> {new DifficultyLevel() {Name = "Level 1"}});

            DifficultyLevelScale fakeScale = new DifficultyLevelScale {Name = "D"};

            IDifficultyLevelService levelService = new DifficultyLevelService(levelDaoMock.Object);
            IList<DifficultyLevel> levelInScale = levelService.GetAllIn(fakeScale);
            Assert.AreEqual(1, levelInScale.Count);

            levelDaoMock.Verify(x=>x.GetAllIn(It.Is<DifficultyLevelScale>(y=>y.Name == fakeScale.Name)));
        }
        public void TestCreate()
        {
            Mock<IDifficultyLevelDao> levelDaoMock = new Mock<IDifficultyLevelDao>();
            levelDaoMock.Setup(x => x.Create(It.IsAny<DifficultyLevelScale>(), It.IsAny<DifficultyLevel>()));

            string scaleName = "D";
            string levelName = "Gebiet 1";
            DifficultyLevelScale fakeScale = new DifficultyLevelScale(){ Name = scaleName };

            IDifficultyLevelService levelService = new DifficultyLevelService(levelDaoMock.Object);
            levelService.Create(fakeScale, levelName, 1000);

            levelDaoMock.Verify(x=>x.Create(It.Is<DifficultyLevelScale>(y=>y.Name == scaleName), It.Is<DifficultyLevel>(y=>y.Name == levelName && y.Score == 1000)), Times.Once);
        }
        public void TestDelete(bool isInUse)
        {
            Mock<IDifficultyLevelDao> difficultyLevelDaoMock = new Mock<IDifficultyLevelDao>();
            difficultyLevelDaoMock.Setup(x => x.IsInUse(It.IsAny<DifficultyLevel>())).Returns(isInUse);
            difficultyLevelDaoMock.Setup(x => x.Delete(It.IsAny<DifficultyLevel>()));

            DifficultyLevel difficultyLevel = new DifficultyLevel();
            IDifficultyLevelService difficultyLevelService = new DifficultyLevelService(difficultyLevelDaoMock.Object);
            difficultyLevelService.Delete(difficultyLevel);

            difficultyLevelDaoMock.Verify(x=>x.IsInUse(difficultyLevel), Times.Once);
            difficultyLevelDaoMock.Verify(x=>x.Delete(difficultyLevel), Times.Once);
        }
        public void TestGetForVariation()
        {
            DifficultyLevel level = new DifficultyLevel();
            Mock<IDifficultyLevelDao> difficultyLevelDaoMock = new Mock<IDifficultyLevelDao>();
            difficultyLevelDaoMock.Setup(x => x.GetLevelOnVariation(It.IsAny<Variation>())).Returns(level);

            Variation variation = new Variation();

            IDifficultyLevelService difficultyLevelService = new DifficultyLevelService(difficultyLevelDaoMock.Object);
            DifficultyLevel levelForVariation = difficultyLevelService.GetForVariation(variation);

            levelForVariation.Should().NotBeNull();
            levelForVariation.Id.Should().Be(level.Id);

            difficultyLevelDaoMock.Verify(x=>x.GetLevelOnVariation(variation), Times.Once);

        }