public ForceConversation(PlayerEventModel playerEventModel) : base(playerEventModel) { var conversationRepository = new ConversationRepository(ContextMap.DefaultMap); var conversationId = uint.Parse(playerEventModel.EventModel.EventContentsModel.Arg[0]); this.conversationModel = conversationRepository.Get(conversationId); this.isAlive = true; }
public AppearConversationCharacter(PlayerEventModel playerEventModel) : base(playerEventModel) { // TODO : この辺のレポジトリを使いまわしできるようにしたい。 var conversationRepository = new ConversationRepository(ContextMap.DefaultMap); var appearCharacterRepository = new AppearCharacterRepository(ContextMap.DefaultMap); var rewardRepository = new RewardRepository(ContextMap.DefaultMap); Debug.Assert(playerEventModel.EventModel.EventContentsModel.Arg.Length >= 3, "AppearConversationCharacter: コンテンツ引数の要素数が3未満です"); var appearCharacterId = uint.Parse(playerEventModel.EventModel.EventContentsModel.Arg[0]); var conversationId = uint.Parse(playerEventModel.EventModel.EventContentsModel.Arg[1]); var rewardId = uint.Parse(playerEventModel.EventModel.EventContentsModel.Arg[2]); this.appearCharacterModel = appearCharacterRepository.Get(appearCharacterId); this.conversationModel = conversationRepository.Get(conversationId); this.rewardModel = rewardRepository.Get(rewardId); }
public void Get() { try { var options = CreateNewContextOptions(); using (var db = new ConversationContext(options)) { ConversationTestHelper.PopulateDefaultDataCtx(db); } using (var db = new ConversationContext(options)) { var repository = new ConversationRepository(db); var item = GenerateModel(); IEnumerable <Conv> result = null; Assert.DoesNotThrow(() => repository.Save(item)); Assert.DoesNotThrow(() => repository.AddMember(new User { Id = 1 }, item)); var filter = new ConversationFilter <int> { UserId = item.UserStartedId, ConversationTypeId = item.ConversationTypeId, }; Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); filter.Code = "Conv1"; Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); filter.Title = "Conversation"; Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); filter.DateCreatedInterval = new Interval <DateTime?> { Start = DateTime.Now.AddDays(-2) }; Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); filter.DateCreatedInterval.Start = null; filter.DateCreatedInterval.End = DateTime.Now.AddDays(2); Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); filter.DateCreatedInterval.Start = DateTime.Now.AddDays(-2); Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Any()); } } catch (Exception ex) { LogEventManager.Logger.Error(ex); throw; } }