public void SerializeDemoMessagesToFile() { ILocationProvider locationProvider = new MockLocationProvider(); IMessageParser realMessageParser = new RegexMessageParser(_singletonTagProvider, locationProvider); MessageRepository tempMessageRepository = new MessageRepository(); TagRepository tempTagRepository = new TagRepository(); IncomingMessageProcessor incomingMessageProcessor = new IncomingMessageProcessor(tempMessageRepository, tempTagRepository, realMessageParser); IRawMessageProvider rawMessageProvider = new DemoMessageProvider(incomingMessageProcessor); rawMessageProvider.Update(); tempMessageRepository.FilePath = "../../data/demo_offers.json"; tempMessageRepository.SerializeToFile(); }
public TestSerialization() { _singletonTagProvider = new TagRepository(); _singletonTagProvider.FilePath = "data/initial_tags.json"; _singletonTagProvider.InitializeFromFile(); ILocationProvider locationProvider = new MockLocationProvider(); IMessageParser realMessageParser = new RegexMessageParser(_singletonTagProvider, locationProvider); _messageRepository = new MessageRepository(); _tagRepository = new TagRepository(); IncomingMessageProcessor incomingMessageProcessor = new IncomingMessageProcessor(_messageRepository, _tagRepository, realMessageParser); IRawMessageProvider rawMessageProvider = new MockRawMessageProvider(incomingMessageProcessor); rawMessageProvider.Update(); }
public TestMessageExecutor() { MockMessageParser mockParser = new MockMessageParser(); ignoredUsers = new IgnoredUserRepository(); //var ignoredUser = MockData.Users[0]; //signoredUsers.Save(ignoredUser); MessageRepository messageRepository = new MessageRepository(ignoredUsers); TagRepository tagRepository = new TagRepository(); IncomingMessageProcessor incomingMessageProcessor = new IncomingMessageProcessor(messageRepository,tagRepository, mockParser); //_target = new TagDexQueryExecutor(); MockRawMessageProvider mockProvider = new MockRawMessageProvider(incomingMessageProcessor); _target = messageRepository; mockProvider.Update(); }
public void InitializeTwitterProvider() { //for this test create real objects all the way down the line - so...more of an integration test really // (which is why this is disabled) TagRepository singletonTagProvider = new TagRepository(); singletonTagProvider.FilePath = "data/initial_tags.json"; singletonTagProvider.InitializeFromFile(); ILocationProvider locationProvider = new MockLocationProvider(); RegexMessageParser realMessageParser = new RegexMessageParser(singletonTagProvider, locationProvider); _messageRepository = new MessageRepository(); _tagRepository = new TagRepository(); IncomingMessageProcessor target = new IncomingMessageProcessor(_messageRepository, _tagRepository, realMessageParser); TwitterRawMessageProvider twitterProvider = new TwitterRawMessageProvider((IRawMessageReceiver)target, new MockWebRequestFactory()); twitterProvider.Update(); }
public void TestPushMessage() { IncomingMessageProcessor processor = new IncomingMessageProcessor(_messageRepository, _tagRepository, new MockMessageParser(), _target, null); _mockProvider = new MockRawMessageProvider(processor); _mockProvider.Update(); }
public void TestVariableTypeSerialization() { MessageRepository messageRepository = new MessageRepository(); // need to keep this seperate so as not to mess up other tests TagRepository tempTagRepository = new TagRepository(); //ditto IMessageParser messageParser = new RegexMessageParser(_singletonTagProvider, new MockLocationProvider()); IRawMessageReceiver messageReceiver = new IncomingMessageProcessor(messageRepository, tempTagRepository, messageParser); //add two messages of different types messageReceiver.Notify(DemoData.RawMessages[0]); messageReceiver.Notify(MockData.RawMessages[0]); var openSocialRawMessage = new OpenSocialRawMessage("ooooby", "i have vegetables available in wellington. for #free. #ooooby", "utunga", "", ""); messageReceiver.Notify(openSocialRawMessage); //serialize out string tempFileName = "testOffers.json"; messageRepository.FilePath = tempFileName; messageRepository.SerializeToFile(); // ok great now check that we can deserialize messageRepository = new MessageRepository(); // need to keep this seperate so as not to mess up other tests messageRepository.FilePath = tempFileName; messageRepository.InitializeFromFile(); Assert.AreEqual(messageRepository.MessageCount, 3, "expected to find 3 messages after deserialization"); //TwitterStatusXml twitterStatus = new TwitterStatusXml(); //twitterStatus.CreatedAt = DateUtils.TwitterTimeStampFromUTCDateTime(DateTime.Now); //twitterStatus. = DateUtils.TwitterTimeStampFromUTCDateTime(DateTime.Now); }