public void ReturnNullWhenAllBotsAreWorkedOrCrashed() { var botDataContext = new MemoryDataContext(); var bot1 = new BotModel { Login = "******", State = EBotState.Worked, }; botDataContext.AddBot(bot1); var bot2 = new BotModel { Login = "******", State = EBotState.Crashed, }; botDataContext.AddBot(bot2); var botRepository = new BotRepository(botDataContext); var resultBot = botRepository.GetFreeBot(); Assert.IsNull(resultBot, "There are free bots in this test."); }
public void Initialize() { Id = 1; var dataContext = new MemoryDataContext(); ExpenseModel = new ExpenseModel(dataContext); }
public void Initialize() { DataContext = new MemoryDataContext(); ObjectToInsert = new object(); DataContext.Save(ObjectToInsert); }
public void SetupData() { dataContext = new MemoryDataContext(); dataContext.AddBotWith("plaprobot", EBotState.Worked); botRepository = new BotRepository(dataContext); logger = new LoggerStub(); steamClient = new SteamClientMock(logger); gameWorker = new GameWorker(botRepository, logger, steamClient); }
public void Initialize() { DataContext = new MemoryDataContext(); ObjectToDelete = new object(); DataContext.Save(ObjectToDelete); DataContext.Commit(); DataContext.Delete(ObjectToDelete); }
public void Initialize() { Id = 1; Expense = new Expense { Id = Id }; var dataContext = new MemoryDataContext(); dataContext.Save(Expense); dataContext.Commit(); ExpenseModel = new ExpenseModel(dataContext); }
public void Initialize() { Id = 1; Expense = new Expense { Id = Id, Amount = 500, Description = "Test" }; DataContext = new MemoryDataContext(); ExpenseModel = new ExpenseModel(DataContext); }
static void Main(string[] args) { var docs = new MemoryRepository <Document>(); var repos = new MemoryRepository <Repository>(); var orgs = new MemoryRepository <Organization>(); var users = new MemoryRepository <User>(); var newOrg = new Organization() { Created = DateTime.UtcNow, Updated = DateTime.UtcNow, Name = "evuru", }; orgs.Add(newOrg); var metadata = new AzureDevOpsMetadata { PersonalAccessToken = "", }; var newRepo = new Repository() { Name = newOrg.Name, OrganizationId = newOrg.Id, SCM = SupportedSystems.GitHub, CustomRepositoryInformation = JsonConvert.SerializeObject(metadata) }; repos.Add(newRepo); var db = new MemoryDataContext(docs, orgs, repos, users); var queue = new MemoryQueue <RepositoryUpdatedMessage>(); while (true) { queue.PushMessage(new RepositoryUpdatedMessage(newRepo.Id)); var scraper = new Scraper(db); scraper.ScrapeRepository(queue.PopMessage()).Wait(); Display(db); Thread.Sleep(30000); } }
public void LoginIsCorrectWhenFreeBotIsExisted() { var botDataContext = new MemoryDataContext(); const string botLogin = "******"; var bot = new BotModel { Login = botLogin, State = EBotState.Free, }; botDataContext.AddBot(bot); var botRepository = new BotRepository(botDataContext); var resultBot = botRepository.GetFreeBot(); Assert.AreEqual(botLogin, resultBot.Login, "Not correct bot's login."); }
public void UpdateBotStateFromWorkedToCrashed() { var botDataContext = new MemoryDataContext(); var bot = new BotModel { Id = new ObjectId("597dd372ab6fc118d85cc08d"), Login = "******", State = EBotState.Worked, }; botDataContext.AddBot(bot); var botsHandler = new BotRepository(botDataContext); botsHandler.UpdateStateBot(bot.Id, EBotState.Crashed); var updatedBot = botDataContext.GetBotByLogin("plaprobot"); Assert.AreEqual(EBotState.Crashed, updatedBot.State, "Bot's state is not updated."); }
public EGameWorkerResult Invite([FromBody] DebugInviteQuery query) { var dataContext = new MemoryDataContext(); dataContext.AddBot( new BotModel { Login = query.Login, Password = query.Password, State = EBotState.Free } ); var botRepository = new BotRepository(dataContext); var steamClient = new SteamClient(logger); var gameWorker = new GameWorker(botRepository, logger, steamClient); var result = gameWorker.Invite(query.InviteSubQuery); return(result); }
} //для тестового приложения - почему-то все слетело, после установки ришарпера public InMemoryRecipientsDataProvider(MemoryDataContext db) { _db = db; _items = _db.Recipients; }
public InMemorySchedularTasksDataProvider(MemoryDataContext db) { _db = db; _items = _db.SchedularTasks; }
public InMemoryEmailsDataProvider(MemoryDataContext db) { _db = db; _items = _db.Emails; }
public void Initialize() { DataContext = new MemoryDataContext(); }
public InMemorySendersDataProvider(MemoryDataContext db) { _db = db; _items = _db.Senders; }