public void GettingAnInvalidTriangle()
        {
            LocatorController locator = new LocatorController(null);

            string[] locationOfTriangle = locator.Get("0,0", "10,1", "10,10");
            Assert.AreEqual("INVALID COORDINATES", locationOfTriangle[0]);
        }
        public void GettingAnOddPositionTriangle()
        {
            LocatorController locator = new LocatorController(null);

            string[] locationOfTriangle = locator.Get("0,0", "0,10", "10,10");
            Assert.AreEqual("A1", locationOfTriangle[0]);
        }
Beispiel #3
0
        /// <inheritdoc />
        /// <summary>
        /// Initialize a new MainWindow object
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            StyleManager.ChangeStyle(this);
            LoadProperties();

            _locatorController = new LocatorController();

            StringVariables stringVariables = new StringVariables
            {
                CancelButtonText      = "Cancel",
                DownloadButtonText    = "Download",
                InformationButtonText = "Information",
                NoNewVersionText      = "You are using the latest version!",
                TitleText             = "DeadPix",
                UpdateNowText         = "Would you like to update DeadPix now?"
            };

            _updateManager = new UpdateManager(Assembly.GetExecutingAssembly().GetName().Version, "https://codedead.com/Software/DeadPix/update.json", stringVariables, DataType.Json);

            try
            {
                if (Properties.Settings.Default.AutoUpdate)
                {
                    _updateManager.CheckForUpdate(false, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "DeadPix", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #4
0
 public void Setup()
 {
     _ipLocationRepositoryMock = new Mock <IIpLocationRepository>();
     _ipValidator = new Mock <IIpValidator>();
     _ipValidator.Setup(x => x.IsIpValid(validIp)).Returns(true);
     _target = new LocatorController(_ipLocationRepositoryMock.Object, _ipValidator.Object);
 }
Beispiel #5
0
        public void GettingAnEvenPositionTriangle()
        {
            RendererController renderer = new RendererController(null);

            string[] ROWS = { "A", "B", "C", "D", "E", "F" };
            foreach (string row in ROWS)
            {
                for (int i = 1; i < 13; i++)
                {
                    Point[]           pixelsOfTriangle  = renderer.Get(row, i);
                    Point[]           vertices          = FindVertices(pixelsOfTriangle);
                    LocatorController locatorController = new LocatorController(null);
                    string[]          position          = locatorController.Get(vertices[0].X + "," + vertices[0].Y, vertices[1].X + "," + vertices[1].Y, vertices[2].X + "," + vertices[2].Y);
                    Assert.AreEqual(row + i, position[0]);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Initialize a new LocatorWindow
        /// </summary>
        /// <param name="controller">The LocatorController that can be used to specify certain parameters</param>
        public LocatorWindow(LocatorController controller)
        {
            _locatorController = controller;
            InitializeComponent();

            _brush     = new SolidColorBrush(_locatorController.SelectedColor);
            Background = _brush;

            try
            {
                _changeColorOnClick = Properties.Settings.Default.LocatorChangeColorOnClick;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "DeadPix", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (_locatorController.RandomizeColors)
            {
                _locatorController.ColorChangedEvent += LocatorControllerOnColorChangedEvent;
            }
        }