コード例 #1
0
        public void GetCompanyIdTest()
        {
            ConfigurationManager.AppSettings["ConnectionInfo"] = "ek49phfby0cs";


            string companyName = "Sub Technologies Inc";
            string expected    = "3987840";
            string actual;

            actual = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expected, actual);

            companyName = "FOUR G CONSTRUCTION INC";
            expected    = "";
            actual      = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expected, actual);

            companyName = "COMET INDUSTRIES INC";
            expected    = "1258384";
            actual      = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expected, actual);

            companyName = "AMPLEFORTH ENTERPRISES INC";
            expected    = "";
            actual      = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expected, actual);

            companyName = "AMERICAN DEHYDRATED FOODS INC";
            expected    = "204339";
            actual      = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        // GET api/contacts
        public IEnumerable <ContactModel> Get(string companyName)
        {
            string companyId = JigsawHelper.GetCompanyId(companyName);

            if (!string.IsNullOrEmpty(companyId))
            {
                return(JigsawHelper.GetContacts(companyId));
            }

            return(null);
        }
コード例 #3
0
        // GET api/contacts/5
        public ContactModel Get(int id)
        {
            var user = ((UserCreditsService)_fileUserCredits).GetByUserId(SessionHelper.CurrentUser.Id);

            if (user.Credits >= 5)
            {
                user.Credits = user.Credits - 5;
                _fileUserCredits.Update(user);
                return(JigsawHelper.GetPurchasedContact(id));
            }

            return(null);
        }
コード例 #4
0
ファイル: JigsawModel.cs プロジェクト: JeffJin/JigsawPuzzel
        private void InitVideoPuzzles(Stream streamSource)
        {
            //create imedia source from the stream
            this.VideoSource = JigsawHelper.CreateVideoSource(streamSource);

            //create image pieces
            IList <IJigsawPiece> pieces = JigsawPieceFactory.CreateVideoPuzzelPieces(this.VideoSource, this._columns,
                                                                                     this._rows, this.PieceSize, this.PieceType);

            //scramble the pieces
            this.Pieces = JigsawHelper.ScramblePieces(pieces, this._rows, this._columns);

            //insert into canvas
            foreach (JigsawPieceBase piece in this.Pieces)
            {
                this.InsertPiece(this.Window.Canvas, piece);
            }
        }
コード例 #5
0
        public void GetPurchasedContactTest()
        {
            ConfigurationManager.AppSettings["ConnectionInfo"] = "ek49phfby0cs";

            ConfigurationManager.AppSettings["JigsawUserName"] = "******";

            ConfigurationManager.AppSettings["JigsawPassword"] = "******";


            string companyName       = "American Dehydrated Foods, Inc.";
            string expectedCompanyId = "204339";
            string actualCompanyId;

            actualCompanyId = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expectedCompanyId, actualCompanyId);


            string companyId = actualCompanyId;
            int    expected  = 16;
            int    actual;
            var    model = JigsawHelper.GetContacts(companyId);

            actual = model.Count;

            Assert.AreEqual(expected, actual);

            long   contactId = model[0].ContactId;
            string email     = "*****@*****.**";
            string address   = "PO BOX 4087";
            string phone     = "+1.417.881.7755";


            var contactInfo = JigsawHelper.GetPurchasedContact(contactId);


            Assert.AreEqual(email, contactInfo.Email);
            Assert.AreEqual(address, contactInfo.Address);
            Assert.AreEqual(phone, contactInfo.Phone);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #6
0
        public void GetContactsTest()
        {
            ConfigurationManager.AppSettings["ConnectionInfo"] = "ek49phfby0cs";

            string companyName       = "American Dehydrated Foods, Inc.";
            string expectedCompanyId = "204339";
            string actualCompanyId;

            actualCompanyId = JigsawHelper.GetCompanyId(companyName);
            Assert.AreEqual(expectedCompanyId, actualCompanyId);


            string companyId = actualCompanyId;
            int    expected  = 16;
            int    actual;
            var    model = JigsawHelper.GetContacts(companyId);

            actual = model.Count;

            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #7
0
        // GET api/contacts/5
        public ContactModel Get(int id)
        {
            var session = _accessor.Current().Session;

            if (session != null)
            {
                var fileList = session["CurrentUser"] as UserModel;
                if (fileList != null)
                {
                    var user = ((UserCreditsService)_fileUserCredits).GetByUserId(fileList.Id);

                    if (user.Credits >= 5)
                    {
                        user.Credits = user.Credits - 5;
                        _fileUserCredits.Update(user);
                        return(JigsawHelper.GetPurchasedContact(id));
                    }
                }
            }


            return(null);
        }
コード例 #8
0
        public void TestConvertPointWithValidStrings()
        {
            const int rows       = 4;
            const int columns    = 4;
            var       imaeSource = new BitmapImage();
            var       pieces     = new List <IJigsawPiece>();

            for (int row = 0; row < rows; row++)
            {
                for (int col = 0; col < columns; col++)
                {
                    IJigsawPiece jigsawPiece = JigsawPieceFactory.CreateImagePuzzelPiece(imaeSource, col, row, 200, PieceType.SimpleBezier);
                    pieces.Add(jigsawPiece);
                }
            }
            var scrambledPieces = JigsawHelper.ScramblePieces(pieces, rows, columns);

            foreach (var jigsawPiece in scrambledPieces)
            {
                var tempModel = BezierCurveHelper.FindModel(jigsawPiece.CurrentColumn, jigsawPiece.CurrentRow);
                Assert.AreEqual(jigsawPiece.Position, tempModel.Position);
            }
        }