public void SeedDB() { using (var db = new LiteDatabase(Constants.DB_NAME)) { //clean up IEnumerable <string> collectionNames = db.GetCollectionNames().ToList(); foreach (string collectionName in collectionNames) { db.DropCollection(collectionName); } } //setup test data Employee nextMgr = new Employee() { Id = Guid.Empty }; for (int i = 0; i < 99; i++) { FakeName fname = GetAName(); DateTime onboardDate = DateTime.Now.AddMonths(random.Next(-100, -12)); DateTime recentPerfReviewDate = new DateTime(DateTime.Now.Year - 1, onboardDate.Month, 1); Employee theNextMgr = EmployeeFactory.CreateEmployee(fname.FirstName, fname.LastName, (Gender)GetValue(genders), fname.Email, nextMgr, (Title)GetValue(titles), (Level)GetValue(levels), random.Next(50000, 200000), random.Next(0, 10000), onboardDate); HistoryFactory.CreateHistory(theNextMgr, nextMgr, (Title)GetValue(titles), (Level)GetValue(levels), random.Next(50000, 200000), random.Next(0, 10000), ActionType.ANNUAL_PERFORMANCE_REVIEW, recentPerfReviewDate); nextMgr = theNextMgr; } }
public void TestFact() { RaceFactory rf = RaceFactory.getRaceFactory(); Assert.IsNotNull(rf); Race jordy = rf.getRace("human"); Race willy = rf.getRace("orc"); PlayerFactory pf = PlayerFactory.getPlayerFactory(); Player p1 = pf.createPlayer(jordy, "francois", null); Assert.AreEqual(p1.name, "francois"); Player p2 = pf.createPlayer(willy, "aurelien", null); Assert.AreEqual(p2.name, "aurelien"); Assert.AreEqual(p1.race.name, jordy.name); Assert.AreEqual(p2.race.name, willy.name); History h = HistoryFactory.getHistoryFactory().createHistory(); Assert.IsNotNull(h); GameStateFactory gsf = GameStateFactory.getStateFactory(); GameState gs = gsf.createGameState(); h.set(gs); h.save(); Assert.AreEqual(h.pop(), gs); }
/// <summary> /// Creates an instance of <see cref="BlobUpdateField"/> /// </summary> /// <param name="bitOffset">The offset of the first bit describing this updatefield in the <see cref="UpdateMask"/>.</param> /// <param name="byteCount">The amount of bytes this blob spans.</param> /// <param name="context">The parsing context.</param> public BlobUpdateField(int bitOffset, int byteCount, ParsingContext context) : base(bitOffset, ((byteCount + 3) & ~3) / 4, // Compute the amount of bits (align up to u32 boundary) context, () => HistoryFactory.Create(() => new byte[byteCount])) { _currentValue = new byte[byteCount]; }
public GuidUpdateField(int bitOffset, ParsingContext context) : base(bitOffset, GetSize(context), context, () => HistoryFactory.Create(context.Helper.GuidResolver.CreateGUID)) { _context = context; }
public void CreateEmployeeHistory(Guid employeeId, Guid managerId, Title title, Level level, Decimal salary, Decimal bonus, ActionType action, DateTime date) { LiteCollection <Employee> employees = PersistenceStore.Current.GetEmployeeStore(); var employee = employees.FindById(employeeId); var manager = managerId == Guid.Empty ? new Employee() { Id = Guid.Empty } : employees.FindById(managerId); HistoryFactory.CreateHistory(employee, manager, title, level, salary, bonus, action, date); }
public IHistory <Entry> this[uint slot] { get { if (EqualityComparer <IHistory <Entry> > .Default.Equals(_auras[slot], default)) { _auras[slot] = HistoryFactory.CreateConcurrent <Entry>(); } return(_auras[slot]); } }
public void Update(HistoryFactory historyFactory, BufferedReader reader) { historyFactory.UpdateHistory(InternalHistory, reader); }
public RawUpdateField(int bitOffset, ParsingContext context) : base(bitOffset, 1, context, () => HistoryFactory.Create(() => new T[Unsafe.SizeOf <uint>() / Unsafe.SizeOf <T>()])) { }
public ShortsUpdateField(int bitOffset, ParsingContext context) : base(bitOffset, 1, context, () => HistoryFactory.Create(() => new short[2])) { }