public void GetCompositeWidth_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            int width = repeater.GetCompositeWidth();

            Assert.AreEqual(2, width);
        }
        public void GetXSubIndexCount_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            int result = repeater.GetXSubIndexCount();

            Assert.AreEqual(2, result);
        }
        public void GetRowAndColumn_Top_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            Tuple <string, int>  value    = repeater.GetRowAndColumn(new Vertex(2.0, 1.0), new Vertex(1.0, 2.0), new Vertex(1.0, 1.0));

            Assert.AreEqual(new Tuple <string, int>("A", 3), value);
        }
        public void GetCompositeHeight_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            int height = repeater.GetCompositeHeight();

            Assert.AreEqual(2, height);
        }
        public void GetAllLines_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            List <Line>          lines    = repeater.GetAllLines();

            // We should have 24 lines for 8 triangles
            Assert.AreEqual(24, lines.Count);
        }
        public void GetXSubIndex_Success()
        {
            KaledioscopeRepeater repeater = testSetup();
            Triangle             tri      = new Triangle(new Vertex(1.0, 1.0), new Vertex(0.0, 1.0), new Vertex(1.0, 0.0));
            int result = repeater.GetXSubIndex(tri.GetCentroid());

            Assert.AreEqual(2, result);
        }
        /// <summary>
        /// Quick controller for fun image display. Better to split it out if more is needed in the future.
        /// </summary>
        /// <param name="rows">Number of rows to create</param>
        /// <param name="columns">Number of columns to create</param>
        /// <returns>An image and 200 response</returns>
        /// <remarks>
        ///		The call is http://yourserverhere/api/Image?row=r&column=c. For example, from the sample:
        ///		http://localhost:64876/api/Image?row=F&column=12
        /// </remarks>
        public HttpResponseMessage Get(string row, int column)
        {
            Triangle          tri1  = new Triangle(new Vertex(0.0, 0.0), new Vertex(10.0, 0.0), new Vertex(0.0, 10.0));
            Triangle          tri2  = (Triangle)TransformationFactory.Translate(TransformationFactory.RotateOnCenter(tri1, Math.PI), 10.0, 10.0);
            KaleidoscopeImage image = new KaleidoscopeImage(new List <IPolygon>()
            {
                tri1, tri2
            }, 10, 10);
            KaledioscopeRepeater repeater = new KaledioscopeRepeater(image, row, column);
            KaleidoscopeDrawer   drawer   = new KaleidoscopeDrawer(repeater);
            Bitmap bmp = drawer.GetImage();

            using (MemoryStream ms = new MemoryStream())
            {
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new ByteArrayContent(ms.ToArray());
                response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/png");
                return(response);
            }
        }
        public void IntToAlphaConverterTest_DoubleB_Success()
        {
            string result = KaledioscopeRepeater.IntToAlphaConverter(54);

            Assert.AreEqual("BB", result);
        }
        public void AlphaToIntConverterTest_DoubleB_Success()
        {
            int result = KaledioscopeRepeater.AlphaToIntConverter("BB");

            Assert.AreEqual(54, result);
        }
 public KaleidoscopeDrawer(KaledioscopeRepeater repeater)
 {
     this._repeater = repeater;
 }