public override void SetUp() { base.SetUp(); tr = new TestRepository<Repository>(db); reader = db.NewObjectReader(); inserter = db.NewObjectInserter(); }
public void SelectSamePiece() { var repository = new TestRepository(); var game = SetupGame(repository); // select a piece var piece = repository.FindAll<Piece>().First(); var color = repository.FindAll<Color>().First(); var player1 = game.Players.First(); var action1 = player1.Actions.Where(x => x.Type == ActionType.SelectPiece).Single(); action1.PerformAction(string.Format("{{'PieceId':'{0}','ColorId':'{1}'}}", piece.Id, color.Id)); // select the same combo of piece/color with another player var player2 = game.Players.Where(x => x.Actions.Where(y => y.Type == ActionType.SelectPiece).Count() > 0).First(); var action2 = player2.Actions.Where(x => x.Type == ActionType.SelectPiece).Single(); action2.PerformAction(string.Format("{{'PieceId':'{0}','ColorId':'{1}'}}", piece.Id, color.Id)); // verify that no piece was selected player2 = repository.Get<Player>(player2.Id); Assert.AreEqual(0, player2.ColorId); Assert.AreEqual(0, player2.PieceId); Assert.IsNotEmpty(player2.Actions.Where(x => x.Type == ActionType.SelectPiece)); var message = player2.Messages.Single(); Assert.AreEqual("Another player has the same piece. Please choose another picture and/or color.", message.Text); }
public void DeleteGame() { var repository = new TestRepository(); // create games with players and used challenges var game1 = CreateGameData(repository); var game2 = CreateGameData(repository); // delete a game game1.Delete(); // verify that the game is deleted Assert.IsEmpty(repository.Find<Game>(x => x.Id == game1.Id)); // verify that players are deleted Assert.IsEmpty(repository.Find<Player>(x => x.GameId == game1.Id)); // verify that challenges are not marked as used Assert.IsEmpty(repository.Find<UsedChallenge>(x => x.GameId == game1.Id)); // verify that data from other game is not deleted Assert.IsNotEmpty(repository.Find<Game>(x => x.Id == game2.Id)); Assert.IsNotEmpty(repository.Find<Player>(x => x.GameId == game2.Id)); Assert.IsNotEmpty(repository.Find<UsedChallenge>(x => x.GameId == game2.Id)); }
public void DeleteChallenge() { var repository = new TestRepository(); // add test challenges var challenge1 = new Challenge() { Question = "Test Question 1" }; var challenge2 = new Challenge() { Question = "Test Question 2" }; repository.Add(challenge1); repository.Add(challenge2); // add answers var answer1a = new ChallengeAnswer() { Answer = "Test Answer 1a", Correct = true, ChallengeId = challenge1.Id }; var answer1b = new ChallengeAnswer() { Answer = "Test Answer 1b", Correct = false, ChallengeId = challenge1.Id }; var answer2a = new ChallengeAnswer() { Answer = "Test Answer 2a", Correct = true, ChallengeId = challenge2.Id }; var answer2b = new ChallengeAnswer() { Answer = "Test Answer 2b", Correct = false, ChallengeId = challenge2.Id }; repository.AddAll(new ChallengeAnswer[] { answer1a, answer1b, answer2a, answer2b }); // delete one challenge challenge1.Delete(); // verify challenge and answers are deleted Assert.IsEmpty(repository.Find<Challenge>(x => x.Id == challenge1.Id)); Assert.IsEmpty(repository.Find<ChallengeAnswer>(x => x.Id == answer1a.Id)); Assert.IsEmpty(repository.Find<ChallengeAnswer>(x => x.Id == answer1b.Id)); // verify other challenge is not deleted Assert.IsNotEmpty(repository.Find<Challenge>(x => x.Id == challenge2.Id)); Assert.IsNotEmpty(repository.Find<ChallengeAnswer>(x => x.Id == answer2a.Id)); Assert.IsNotEmpty(repository.Find<ChallengeAnswer>(x => x.Id == answer2b.Id)); }
public void SyncStatusStartsWithOfflineStatus() { this.SetupMocks(); var underTest = new TestRepository(this.repoInfo, this.listener, this.queue); Assert.That(underTest.Status, Is.EqualTo(SyncStatus.Disconnected)); }
public override void SetUp() { base.SetUp(); db = CreateBareRepository(); reader = db.NewObjectReader(); test = new TestRepository<FileRepository>(db); }
public void Setup() { _testRep = new TestRepository(); _rep = new CachingRepository(_testRep, new TestEventStore()); _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid()); _rep.Save(_aggregate,-1); }
public void RecentMessages() { var repository = new TestRepository(); // create a player with some messages var player = new Player(); repository.Add(player); var message1 = new Message() { PlayerId = player.Id }; var message2 = new Message() { PlayerId = player.Id }; var message3 = new Message() { PlayerId = player.Id }; var message4 = new Message() { PlayerId = player.Id }; var message5 = new Message() { PlayerId = player.Id }; repository.Add(message1); repository.Add(message2); repository.Add(message3); repository.Add(message4); repository.Add(message5); // verify that the correct messages are returned and in the correct order var expectedMessages = new Message[] { message5, message4, message3 }.Select(x => x.Id); var recentMessages = player.RecentMessages(3).Select(x => x.Id); Assert.AreEqual(expectedMessages, recentMessages); // add more messages var message6 = new Message() { PlayerId = player.Id }; var message7 = new Message() { PlayerId = player.Id }; repository.Add(message6); repository.Add(message7); // verify that the correct messages are returned and in the correct order expectedMessages = new Message[] { message7, message6, message5 }.Select(x => x.Id); recentMessages = player.RecentMessages(3).Select(x => x.Id); Assert.AreEqual(expectedMessages, recentMessages); }
public void CopyBoard() { var repository = new TestRepository(); // create a board and associated data var board = CreateBoardData(repository); // copy the board var copiedBoard = board.Copy(); // verify that the board and spaces are copied, and challenge links are copied but challenges are the same Assert.AreNotEqual(board.Id, copiedBoard.Id); Assert.AreEqual(board.ImageId, copiedBoard.ImageId); Assert.AreEqual(board.Active, copiedBoard.Active); Assert.AreEqual(board.Description, copiedBoard.Description); Assert.AreEqual(board.Name, copiedBoard.Name); Assert.AreEqual(board.OwnerId, copiedBoard.OwnerId); Assert.AreEqual(board.TurnsToEnd, copiedBoard.TurnsToEnd); Assert.AreEqual(board.NameCardsToEnd, copiedBoard.NameCardsToEnd); Assert.AreEqual(board.SafeHavenCardsToEnd, copiedBoard.SafeHavenCardsToEnd); Assert.AreNotEqual(board.Spaces.Select(x => x.Id), copiedBoard.Spaces.Select(x => x.Id)); Assert.AreEqual(board.Spaces.Select(x => copiedBoard.Id), copiedBoard.Spaces.Select(x => x.BoardId)); Assert.AreEqual(board.Spaces.Select(x => x.Order), copiedBoard.Spaces.Select(x => x.Order)); Assert.AreNotEqual(board.Spaces.Select(x => x.ChallengeCategories.Select(y => y.Id)), copiedBoard.Spaces.Select(x => x.ChallengeCategories.Select(y => y.Id))); Assert.AreEqual(board.Spaces.Select(x => x.ChallengeCategories.Select(y => repository.Get<ChallengeCategory>(y.ChallengeCategoryId).Id)), copiedBoard.Spaces.Select(x => x.ChallengeCategories.Select(y => repository.Get<ChallengeCategory>(y.ChallengeCategoryId).Id))); Assert.AreEqual(board.Challenges.Select(x => x.Id), copiedBoard.Challenges.Select(x => x.Id)); }
public void CloneSpace() { var repository = new TestRepository(); // create a space var space = new Space() { BackgroundColorId = 1, BoardId = 2, Height = 3, ImageId = 4, Order = 5, TextColorId = 6, Type = SpaceType.TurnAround, Width = 7, X = 8, Y = 9, IconId = 11 }; repository.Add(space); // clone the space var clonedSpace = space.Clone(); // verify that space was cloned Assert.AreNotEqual(space.Id, clonedSpace.Id); Assert.AreEqual(clonedSpace.BackgroundColorId, space.BackgroundColorId); Assert.AreEqual(clonedSpace.BoardId, space.BoardId); Assert.AreEqual(clonedSpace.Height, space.Height); Assert.AreEqual(clonedSpace.ImageId, space.ImageId); Assert.AreEqual(clonedSpace.Name, space.Name); Assert.AreEqual(clonedSpace.Order, space.Order); Assert.AreEqual(clonedSpace.TextColorId, space.TextColorId); Assert.AreEqual(clonedSpace.Type, space.Type); Assert.AreEqual(clonedSpace.Width, space.Width); Assert.AreEqual(clonedSpace.X, space.X); Assert.AreEqual(clonedSpace.Y, space.Y); Assert.AreEqual(clonedSpace.IconId, space.IconId); }
public void GetNextChallengeBoardCategory() { var repository = new TestRepository(); // create a game with some challenges var board = new Board(); repository.Add(board); var game = new Game() { BoardId = board.Id }; repository.Add(game); var category = new ChallengeCategory(); repository.Add(category); var challenge1 = new Challenge() { ChallengeCategoryId = category.Id }; var challenge2 = new Challenge() { ChallengeCategoryId = category.Id }; var challenge3 = new Challenge() { ChallengeCategoryId = category.Id }; var challenges = new Challenge[] { challenge1, challenge2, challenge3 }; repository.AddAll(challenges); repository.Add(new BoardChallengeCategory() { BoardId = board.Id, ChallengeCategoryId = category.Id }); // keep getting the next challenge until all challenges should have been used var usedChallenges = new List<Challenge>(); foreach (Challenge challenge in challenges) { usedChallenges.Add(game.GetNextChallenge(0)); } // verify that all challenges were used CollectionAssert.AreEqual(challenges.Select(x => x.Id).OrderBy(x => x), usedChallenges.Select(x => x.Id).OrderBy(x => x)); // verify that more challenges can be retrieved Assert.IsNotNull(game.GetNextChallenge(0)); }
public DataApi() { var dbContext = new InterviewQContext(); Tests = new TestRepository(dbContext); Questions = new QuestionRepository(dbContext); DifficultyLevels = new DifficultyLevelRepository(dbContext); Catagories = new CatagoryRepository(dbContext); }
public When_saving_aggregate() { _testRep = new TestRepository(); _rep = new CacheRepository(_testRep, new TestInMemoryEventStore(), new CqrsMemoryCache()); _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid()); _aggregate.DoSomething(); _rep.Save(_aggregate, -1); }
public override void SetUp() { base.SetUp(); testDb = new TestRepository(db); df = new DiffFormatter(DisabledOutputStream.INSTANCE); df.SetRepository(db); df.SetAbbreviationLength(8); }
public FootlooseFSTestUnitOfWork() { List<Person> persons = TestDataStore.GetPersonTestData(); _persons = new TestRepository<Person>(); foreach (Person person in persons) _persons.Add(person); }
public void Setup() { _repository = new TestRepository<EntityObject>(); _entity = new EntityObject { Name = "Candy", Description = "Delicious" }; }
public void Execute(IJobExecutionContext context) { using (var testRepository = new TestRepository()) { using (var codeRepository = new CodeRepository()) { using (var resultRepository = new ResultRepository()) { ICompiler compiler = new CSharpCompiler(); var processBuilder = new ProcessBuilder(); var runer = new Runer(); List<Code> codes = codeRepository.ExtractAll().ToList(); codes.ForEach(item => { if (!compiler.TryCompile(item.Text, @"F://test.exe")) { resultRepository.Add(new TestDatabase.Entities.Result(item.Id, "compilation error")); } else { var tests = testRepository.GetTestsByTaskId(item.TaskId).ToList(); for (var i = 0; i < tests.Count; i++) { var proc = processBuilder.Create(@"F://test.exe"); string output; try { if (!runer.TryGetResult(proc, tests[i].Input, out output)) { resultRepository.Add(new TestDatabase.Entities.Result(item.Id, "out of time on test " + (i + 1).ToString())); return; } } catch (Exception e) { resultRepository.Add(new TestDatabase.Entities.Result(item.Id, "out of memory on test " + (i + 1).ToString())); return; } if (output == tests[i].Output) continue; resultRepository.Add(new TestDatabase.Entities.Result(item.Id, "wrong answer on test " + (i + 1).ToString())); return; } resultRepository.Add(new TestDatabase.Entities.Result(item.Id, "success")); } }); } } } }
public void AddEmployee_Get_Should_Return_Add_Employee_View() { var testRepository = new TestRepository(); var employeeController = new EmployeeController(testRepository); var result = employeeController.AddEmployee(); Assert.IsNotNull(result); Assert.AreEqual( "AddEmployee", ((ViewResult)result).ViewName); }
public override void SetUp() { base.SetUp(); tr = new TestRepository<Repository>(db); reader = db.NewObjectReader(); inserter = db.NewObjectInserter(); merger = new DefaultNoteMerger(); noteOn = tr.Blob("a"); baseNote = NewNote("data"); }
public override void SetUp() { base.SetUp(); diskRepo = CreateBareRepository(); refdir = (RefDirectory)diskRepo.RefDatabase; repo = new TestRepository<Repository>(diskRepo); A = repo.Commit().Create(); B = repo.Commit(repo.GetRevWalk().ParseCommit(A)); v1_0 = repo.Tag("v1_0", B); repo.GetRevWalk().ParseBody(v1_0); }
public void CanGetAllEntities() { // Arrange var repo = new TestRepository( Session ); // Act var all = repo.GetAll().ToArray(); // Assert Assert.AreEqual( TestData.Length, all.Length ); }
/// <exception cref="System.Exception"></exception> public override void SetUp() { base.SetUp(); util = new TestRepository<Repository>(db); StoredConfig config = util.GetRepository().GetConfig(); config.SetString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants .CONFIG_KEY_REMOTE, "origin"); config.SetString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants .CONFIG_KEY_MERGE, "refs/heads/master"); config.SetString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "fetch", "+refs/heads/*:refs/remotes/origin/*" ); }
public void Setup() { _testRep = new TestRepository(); _rep = new CacheRepository(_testRep, new TestInMemoryEventStore()); _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid()); _aggregate.DoSomething(); try { _rep.Save(_aggregate, 100); } catch (Exception){} }
public void ShouldKnowToInstantiateContext() { var dbSet = new Mock<IDbSet<Book>>(); var dbContext = new Mock<PukuDbContext>(); dbContext.Setup(ctx => ctx.GetDbSet<Book>()).Returns(dbSet.Object); var efRepo = new TestRepository(); Assert.IsNull(efRepo.GetContextInstance()); efRepo.DoStuffThatUsesContextPropery(); Assert.IsNotNull(efRepo.GetContextInstance()); }
public void RepositoryIsUsedForNestedTypeWhenSupplied() { var mapper = new MemberMapper(); var repo = new TestRepository(); mapper.MapRepository = repo; var result = mapper.Map<SourceTypeWithNested, DestinationTypeWithNested>(new SourceTypeWithNested { Foo = new SourceTypeNested { ID = "1" } }); Assert.AreEqual(1, result.Foo.Test); }
public void RepositoryIsUsedWhenSupplied() { var mapper = new MemberMapper(); var repo = new TestRepository(); mapper.MapRepository = repo; var result = mapper.Map<SourceType, DestinationType>(new SourceType { ID = "1" }); Assert.AreEqual(1, result.Test); }
public void DeleteOnlyPlayer() { var repository = new TestRepository(); // create a single player var player = CreatePlayerData(repository); // delete the player player.Delete(); // verify that delete works when there are no other players (especially concerned about updating NextPlayerId) VerifyPlayerDataDeleted(player, repository); }
public override void setUp() { base.setUp(); diskRepo = createBareRepository(); refdir = (RefDirectory)diskRepo.RefDatabase; repo = new TestRepository(diskRepo); A = repo.commit().create(); B = repo.commit(repo.getRevWalk().parseCommit(A)); v1_0 = repo.tag("v1_0", B); repo.getRevWalk().parseBody(v1_0); }
public void GetEntityByIDTest() { IUnitOfWork unitOfWork = new TestDBContext(); // TODO: 初始化为适当的值 TestRepository target = new TestRepository(unitOfWork); // TODO: 初始化为适当的值 TestModel actual = new TestModel(); actual.testName = "name"; actual.testDesc = "1223"; target.Insert(actual); target.Save(); TestModel expected = target.GetEntityByID(actual.testID); Assert.AreEqual(expected.testID, actual.testID,"新插入数据ID用来获取,其结果ID不一致"); }
public When_saving_fails() { _memoryCache = new MemoryCache(); _testRep = new TestRepository(); _rep = new CacheRepository(_testRep, new TestInMemoryEventStore(), _memoryCache); _aggregate = _testRep.Get<TestAggregate>(Guid.NewGuid()); _aggregate.DoSomething(); try { _rep.Save(_aggregate, 100); } catch (Exception) { } }
public TestsModel(UserManager <ApplicationUser> userManager, TestRepository testRepository) { this.InputSearch = new SearchInput(); this.userManager = userManager; this.testRepository = testRepository; }
public static Test UpdateTest(int testId) { TestRepository testRepository = new TestRepository(); Test updatedtest = testRepository.GetTestById(testId); Console.WriteLine("***Test updating***\n"); Console.WriteLine("Please, enter a new title"); string newTitle = Console.ReadLine(); updatedtest.Title = newTitle; Console.WriteLine("Please, enter a new description"); string newDescription = Console.ReadLine(); updatedtest.Description = newDescription; Console.WriteLine("There are available topics, that you can choose.\n"); TreeStructureTopics treeStructureTopics = new TreeStructureTopics(); Topic topic = null; do { treeStructureTopics.GetTreeTopic(); Console.WriteLine("*Choose a new topic/sub-topic/ sub-subTopic of this test and write it below this text*\n"); string topicName = Console.ReadLine(); var existingTopic = treeStructureTopics.GetTopicName(topicName); if (existingTopic == null) { Console.WriteLine("!Please, write the name one of topics given below!\n" + $"----Uncurrect topic '{topicName}'"); } topic = existingTopic; } while (topic == null); updatedtest.Topic = topic.Name; string isTimerExist; Console.WriteLine("Do you want to update a timer in your test? y/n"); do { Console.WriteLine($"Current time in this test is set to: {updatedtest.Time} "); isTimerExist = Console.ReadLine(); if (isTimerExist.ToLower() == "y") { int timerHours; int timerMinutes; int timerSeconds; string userTime; int userParsedTime; bool isConverted; do { Console.WriteLine("Please, enter a hours"); userTime = Console.ReadLine(); isConverted = int.TryParse(userTime, out userParsedTime); } while (isConverted == false); timerHours = userParsedTime; do { Console.WriteLine("Please, enter a minutes"); userTime = Console.ReadLine(); isConverted = int.TryParse(userTime, out userParsedTime); } while (isConverted == false); timerMinutes = userParsedTime; do { Console.WriteLine("Please, enter a seconds"); userTime = Console.ReadLine(); isConverted = int.TryParse(userTime, out userParsedTime); } while (isConverted == false); timerSeconds = userParsedTime; updatedtest.Time = new TimeSpan(timerHours, timerMinutes, timerSeconds); break; } else { if (isTimerExist.ToLower() == "n") { updatedtest.Time = default; break; } else { Console.WriteLine("Please,enter 'y' or 'n' to continue..."); } } } while (isTimerExist != "y" & isTimerExist != "no"); bool exitFromQuestionChanges = default; do { string selectedFunction; bool isUserStringParsed; int chosenFunction; do { Console.WriteLine(@"You can take the following functions : 1) delete existing questions by ID 2) delete all existing questions 3) add questions to existing"); selectedFunction = Console.ReadLine(); isUserStringParsed = int.TryParse(selectedFunction, out chosenFunction); if (string.IsNullOrWhiteSpace(selectedFunction)) { Console.WriteLine("!!!Alert!!!\n Empty input, please choose something"); } else { if (!isUserStringParsed) { Console.WriteLine($"!!!Alert!!!\n {selectedFunction} is not a number, please, try again.."); } else { if ((chosenFunction > 3 || chosenFunction < 1)) { Console.WriteLine("Incorrect number, try a different"); } } } } while (!isUserStringParsed || (chosenFunction > 3 || chosenFunction < 1)); switch (selectedFunction) { case "1": bool isParsed; Question deletedItemQuestion; // Answer deletedItemAnswer; string userContinue; bool isExistingQuestion = true; do { if (updatedtest.Questions.Count == 0) { Console.WriteLine("This test has no questions..."); break; } Console.WriteLine("Existing questions in this test :"); foreach (var questions in updatedtest.Questions) { Console.WriteLine($"{questions.Id})-{questions.Body}"); } do { Console.WriteLine("Enter the id of question you want to delete"); isParsed = int.TryParse(Console.ReadLine(), out int questionId); if (isParsed) { deletedItemQuestion = updatedtest.Questions.Where(x => x.Id == questionId).FirstOrDefault(); if (deletedItemQuestion == null) { Console.WriteLine("This id is not correct"); isExistingQuestion = false; } else { testRepository.DeleteQuestionsById(questionId, updatedtest.Id); Console.WriteLine("Item succesufully deleted"); isExistingQuestion = true; } } else { Console.WriteLine("This is not a number, please, enter a number"); isExistingQuestion = false; } } while (isParsed != true || isExistingQuestion != true); Console.WriteLine("Do you want to continue delete existing questions? y/n"); do { userContinue = Console.ReadLine(); if (userContinue.ToLower() == "n") { Console.WriteLine("Exit from updating questons..."); } else { if (userContinue.ToLower() == "y") { Console.WriteLine("Continue..."); } else { Console.WriteLine("Uncorrect enter, please, enter y or n"); } } } while (userContinue != "y" && userContinue != "n"); if (updatedtest.Questions.Count == 0) { Console.WriteLine("This test has no questions..."); break; } } while (userContinue.ToLower() != "n"); break; case "2": testRepository.DeleteAllQuestionsAndAnswers(updatedtest.Id); Console.WriteLine("All questions and asnwers has been removed"); break; case "3": bool userAnsw = true; do { Console.WriteLine("Please add a question in your test..."); string userQuestion = Console.ReadLine(); Console.WriteLine("Please, add a answer to the question below..."); string answerToUserQuestion = Console.ReadLine(); updatedtest.Questions.Add(new Question { Body = userQuestion, Answer = new Answer { Body = answerToUserQuestion } }); Console.WriteLine("Do you want to create one more question? y/n"); do { var userEnter = Console.ReadLine(); if (userEnter.ToLower() == "y") { userAnsw = true; break; } else { if (userEnter.ToLower() == "n") { Console.WriteLine(" You have added new questions...\n"); userAnsw = false; } else { Console.WriteLine("Please,enter 'y' or 'n' to continue..."); userAnsw = true; } } } while (userAnsw == true); } while (userAnsw == true); testRepository.UpdateTest(updatedtest); break; default: break; } Console.WriteLine("Do you wanna to continue make changes in questions? y/n"); string userDesision; do { userDesision = Console.ReadLine(); if (userDesision.ToLower() == "n") { Console.WriteLine("Exit from questions changes"); exitFromQuestionChanges = false; break; } else { if (userDesision.ToLower() == "y") { Console.WriteLine("Continue updating questions..."); exitFromQuestionChanges = true; } else { Console.WriteLine("Please, enter y or n to continue..."); } } } while (userDesision.ToLower() != "n" && userDesision.ToLower() != "y"); } while (exitFromQuestionChanges != false); return(updatedtest); }
public AccountControllerTest() { this.userRepository = new UserRepository(); this.testRepository = new TestRepository(); this.db = new AssessmentDbContext(); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <EmailSendHistory>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <InformationClass>(new Solution.DataAccess.DataModel.SolutionDataBaseDB()); }
public TimerHub(TestRepository testRepository) { this.testRepository = testRepository; }
public override void TestInitialize() { base.TestInitialize(); Db = new TestRepository(); }
public void Init() { _repo = new TestRepository(); }
static void Main(string[] args) { try { string dbName = "test"; string collectionName = "users"; // Adding convention ConventionPack conventionPack = new ConventionPack { new CamelCaseElementNameConvention() }; ConventionRegistry.Register("camelCase", conventionPack, t => true); TestRepository repository = new TestRepository(); // Get databases names Console.WriteLine("Databases:"); foreach (string s in repository.GetDatabaseNames().Result) { Console.WriteLine(s); } Console.WriteLine(); // Get collections names Console.WriteLine("Collections in database {0}:", dbName); foreach (string s in repository.GetCollectionsNames(dbName).Result) { Console.WriteLine(s); } Console.WriteLine(); // Objects mapping BsonClassMap.RegisterClassMap <Person>(cm => { cm.AutoMap(); }); // Adding documents Person p = new Person { Name = "Andrew", Surname = "Li", Age = 52, Company = new Company { Name = "Google" } }; repository.AddDocument(dbName, collectionName, p); // Find docs Console.WriteLine("Find docs in {0}:", dbName); foreach (string s in repository.FindDocs <BsonDocument>(dbName, collectionName).Result) { Console.WriteLine(s); } Console.WriteLine(); } catch (Exception e) { Console.WriteLine(e); } Console.ReadKey(); }
public int Sum(int i, int j) { ITestRepository testService = new TestRepository(); return(testService.Sum(i, j)); }
protected string GetTestName(int packageId) { ITestRepository testRepository = new TestRepository(); return(testRepository.GetTestNamesByPackageId(Convert.ToInt64(packageId))); }
public void SetUp() { _stateManager = new MockReliableStateManager(); _testRepository = new TestRepository(_stateManager, DictId); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <PREPARE00>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
public void Init() { _repo = new TestRepository(); _grid = new TestGrid(_repo.GetAll()); }
public static void ResetTestRepo() { _testRepo = null; SetTestRepo(); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <UploadType>(new Solution.DataAccess.DataModel.SolutionDataBaseDB()); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <V_PROD_CATE>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
public IndexModel(TestRepository testRepo) { this._testRepo = testRepo; }
public void Init() { _query = (new DefaultHttpContext()).Request.Query; _repo = new TestRepository(); _grid = new TestGrid(_repo.GetAll()); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <SHOP_ACCOUNT>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
public AuditTestRepository(IAuditRepository <TestModel> auditRepository, TestRepository testRepository) { _auditRepository = auditRepository; _testRepository = testRepository; }
public UnitOfWork() { Tests = new TestRepository(context); }
protected string GetTestName(long packageId) { ITestRepository testRepository = new TestRepository(); return(testRepository.GetTestNamesByPackageId(packageId)); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <SHOP_SUPPLIER_RELATION>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
public HomeController(IFlowService flowService, UserManager <ApplicationUser> userManager, TestRepository testRepository) { this.flowService = flowService; this.userManager = userManager; this.testRepository = testRepository; }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <COL_ORDER02>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
static void SetTestRepo() { _testRepo = _testRepo ?? new TestRepository <RECEIVABLES01>(new Solution.DataAccess.DataModel.SolutionDataBase_standardDB()); }
public TestService() { testRepository = unitOfWork.Testes as TestRepository; }
public void BigNotSoSpecificHybridRepositoryTest() { var flush = new ManualResetEvent(false); var flushContinue = new ManualResetEvent(false); var flushEnd = new ManualResetEvent(false); var injectedRepository = new TestRepository(flush, flushContinue); var hybridRepository = new HybridRepository <string, string>(injectedRepository); injectedRepository.AddOrUpdate("A", "A"); injectedRepository.AddOrUpdate("B", "B"); new Task( () => { hybridRepository.TakeSnapshot(); hybridRepository.FlushSnapshot(); flushEnd.Set(); }).Start(); flush.WaitOne(); hybridRepository.AddOrUpdate("A", "A_changed"); hybridRepository.Remove("B"); hybridRepository.AddOrUpdate("C", "C"); // assertions injectedRepository.Get("A").Should().Be("A", "ref1"); injectedRepository.Get("B").Should().Be("B", "ref2"); hybridRepository.Get("A").Should().Be("A_changed", "ref3"); hybridRepository.Get("B").Should().BeNull("ref4"); hybridRepository.Get("C").Should().Be("C", "ref5"); flushContinue.Set(); flushEnd.WaitOne(); // assertions injectedRepository.Get("A").Should().Be("A", "ref6"); injectedRepository.Get("B").Should().Be("B", "ref7"); hybridRepository.Get("A").Should().Be("A_changed", "ref8"); hybridRepository.Get("B").Should().BeNull("ref9"); hybridRepository.Get("C").Should().Be("C", "ref10"); var memoryRepository = new MemoryRepository <string, string>(); hybridRepository = new HybridRepository <string, string>(injectedRepository); // NOTE (Cameron): Equivalent of event re-playing. hybridRepository.AddOrUpdate("A", "A_changed"); hybridRepository.Remove("B"); hybridRepository.AddOrUpdate("C", "C"); // assertions injectedRepository.Get("A").Should().Be("A", "ref11"); injectedRepository.Get("B").Should().Be("B", "ref12"); hybridRepository.Get("A").Should().Be("A_changed", "ref13"); hybridRepository.Get("B").Should().BeNull("ref14"); hybridRepository.Get("C").Should().Be("C", "ref15"); hybridRepository.AddOrUpdate("C", "C_changed"); hybridRepository.AddOrUpdate("D", "D"); // assertions injectedRepository.Get("A").Should().Be("A", "ref16"); injectedRepository.Get("B").Should().Be("B", "ref17"); hybridRepository.Get("A").Should().Be("A_changed", "ref18"); hybridRepository.Get("B").Should().BeNull("ref19"); hybridRepository.Get("C").Should().Be("C_changed", "ref20"); hybridRepository.Get("D").Should().Be("D", "ref21"); hybridRepository.TakeSnapshot(); hybridRepository.FlushSnapshot(); flushContinue.Set(); flushEnd.WaitOne(); // assertions injectedRepository.Get("A").Should().Be("A_changed", "ref22"); injectedRepository.Get("B").Should().BeNull("ref23"); injectedRepository.Get("C").Should().Be("C_changed", "ref24"); injectedRepository.Get("D").Should().Be("D", "ref25"); flush.Dispose(); flushContinue.Dispose(); flushEnd.Dispose(); }
private RuntimeInfo() { TestRepos = new TestRepository(); AppController = new AppController(); }