Exemplo n.º 1
0
        public void Test_InitLightsGridInSolvableState_method()
        {
            var dimension = 5;

            var populator   = new Mock <ILightsPopulator>();
            var lightsGrid1 = It.IsAny <LightsGrid>();

            populator.Setup(p => p.InitLightsGrid(dimension)).Returns(lightsGrid1);
            var lightsGrid2 = It.IsAny <LightsGrid>();

            populator.Setup(p => p.ResetAllLights(lightsGrid1)).Returns(lightsGrid2);
            var lightsGrid3 = It.IsAny <LightsGrid>();

            populator.Setup(p => p.PopulateSolvableState(lightsGrid2)).Returns(lightsGrid3);

            var mng = new LightsManager(populator.Object, null);

            var result = mng.InitLightsGridInSolvableState(dimension);

            populator.Verify(p => p.InitLightsGrid(dimension), Times.Once);
            populator.Verify(p => p.ResetAllLights(lightsGrid1), Times.Once);
            populator.Verify(p => p.PopulateSolvableState(lightsGrid2), Times.Once);
            Assert.AreSame(result, lightsGrid3);
        }