Exemplo n.º 1
0
 /// <summary>
 /// Создание экземпляров классов
 /// слоя Model шаблона MVP.
 /// </summary>
 void InitCanvasModelLayer()
 {
     painter                      = new Painter(viewMainForm.GetPictureBoxWidth, viewMainForm.GetPictureBoxHeight);
     colorsInstanceList           = new ColorsInstanceList();
     figureInstanceList           = new FigureInstanceList();
     figureInstanceList.Instances = TypeFinder.CreateInstances <IFigure>();
     colorsInstanceList.Instances = TypeFinder.CreateInstances <IColor>();
 }
Exemplo n.º 2
0
        public void CreateInstance_PassIColorType_ListReturnSuccess()
        {
            //Arrange
            ColorsInstanceList colorsInstanceList = new ColorsInstanceList();
            List <IColor>      expected;

            //Act
            colorsInstanceList.Instances = TypeFinder.CreateInstances <IColor>();
            expected = colorsInstanceList.Instances;
            //Assert
            Assert.AreEqual(typeof(List <IColor>), expected.GetType());
        }
Exemplo n.º 3
0
        public void GetNames_PassIColor_ReturnCorrectType()
        {
            //Arrange
            ColorsInstanceList colorsInstanceList = new ColorsInstanceList();
            List <string>      expected;

            //Act
            colorsInstanceList.Instances = TypeFinder.CreateInstances <IColor>();

            expected = TypeFinder.GetNames <IColor>(colorsInstanceList.Instances);
            //Assert
            Assert.AreEqual(typeof(List <string>), expected.GetType());
        }
Exemplo n.º 4
0
        public void GetNames_PassIColor_ReturnCorrectListElement()
        {
            //Arrange
            ColorsInstanceList colorsInstanceList = new ColorsInstanceList();
            List <string>      expected;

            //Act
            colorsInstanceList.Instances = TypeFinder.CreateInstances <IColor>();
            expected = TypeFinder.GetNames <IColor>(colorsInstanceList.Instances);

            //Assert
            Assert.IsTrue(expected.Contains("Red") == true);
            Assert.IsTrue(expected.Contains("Square") == false);
        }