Esempio n. 1
0
        public void ConvertSupplement_Steroids()
        {
            var sup = SessionOld.QueryOver <Model.Old.Suplement>().Where(x => x.SuplementId == new Guid("F099FF98-BB78-4E99-AFA3-EE0355974CD9")).SingleOrDefault();

            SessionOld.Delete(sup);
            SessionOld.Flush();
            var supplement = new Suplement();

            supplement.Name        = "supp";
            supplement.Comment     = "dfgdfgdfg";
            supplement.SuplementId = new Guid("F099FF98-BB78-4E99-AFA3-EE0355974CD9");
            supplement.Url         = "test";
            insertToOldDatabase(supplement);

            Convert();

            var newSupplement = SessionNew.Get <Model.Suplement>(supplement.SuplementId);

            Assert.AreEqual(supplement.Name, newSupplement.Name);
            Assert.AreEqual(supplement.Comment, newSupplement.Comment);
            Assert.AreEqual(supplement.Url, newSupplement.Url);
            Assert.IsTrue(newSupplement.CanBeIllegal);
            Assert.IsFalse(newSupplement.IsProduct);
        }
Esempio n. 2
0
        public void ConvertProfile_WithMoreThan50LoginData()
        {
            Model.Old.Profile oldProfile = new Model.Old.Profile();
            oldProfile.UserName     = "******";
            oldProfile.Email        = "*****@*****.**";
            oldProfile.Birthday     = DateTime.Now.Date;
            oldProfile.CreationDate = DateTime.Now.Date.AddDays(-1);
            oldProfile.CountryId    = 2;
            oldProfile.Password     = "******";
            oldProfile.Privacy      = new Model.Old.ProfilePrivacy();
            oldProfile.Settings     = new Model.Old.ProfileSettings();
            insertToOldDatabase(oldProfile);

            for (int i = 0; i < 55; i++)
            {
                var wp71 = new Model.Old.LoginData();
                wp71.ProfileId           = oldProfile.Id;
                wp71.ApplicationLanguage = "pl";
                wp71.ApplicationVersion  = "Free 2.3.0";
                wp71.ClientInstanceId    = Guid.NewGuid();
                wp71.LoginDateTime       = DateTime.Now.Date.AddDays(-100 + i);
                wp71.Platform            = Model.Old.PlatformType.WindowsPhone;
                wp71.PlatformVersion     = "1.";
                SessionOld.Save(wp71);
            }
            SessionOld.Flush();


            Convert();

            var dbProfile = SessionNew.QueryOver <Profile>().Where(x => x.UserName == "test").SingleOrDefault();

            Assert.AreEqual(AccountType.PremiumUser, dbProfile.Licence.AccountType);
            Assert.AreEqual(90, dbProfile.Licence.BAPoints);
            Assert.AreEqual(DateTime.UtcNow.Date, dbProfile.Licence.LastPointOperationDate.Date);
        }