static void Main(string[] args) { Console.WriteLine("Starting sending random AssesmentCompleted Events"); var settings = InfrastructureSettings.Read(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase), "Settings.xml")); var serializer = new JsonTextSerializer(); var metadata = new StandardMetadataProvider(); var topicSender = new TopicSender(settings.ServiceBus, "AssesmentTopic"); var eventBus = new EventBus(topicSender, metadata, serializer); int baseTopicId = 10021; for (int i = 0;; i++) { var assesmentCompleted = new AssesmentCompleted { SubjectId = 1002, TopicId = baseTopicId++, CompletedDate = DateTime.Now, PassThreshold = 80, Score = 70, StudentId = i, TopicName = "Topic " + i }; eventBus.Publish(assesmentCompleted); Console.WriteLine("Published :" + assesmentCompleted.TopicName); Thread.Sleep(10000); } }
public override void Handle(AssesmentCompleted @event) { if (@event.CompletedDate.Subtract(@event.CompletedDate).TotalMilliseconds < 5000) { Pubnub.publish<string>("Achievements", new Achievement { DateEarnt = DateTime.Now, Name = "Quickdraw McGraw", Description = "Well Done, you have erant the Quickdraw achievement by answering in under 5 seconds!!" }, result => Trace.WriteLine(result)); } }
public void Matrices(AnswerViewModel answerViewModel) { var assesmentCompleted = new AssesmentCompleted { SubjectId = 1002, TopicId = 10022, StartDate = answerViewModel.StartDate, CompletedDate = DateTime.Now, PassThreshold = 100, Score = 100, StudentId = 1, TopicName = "Matrix Transformations" }; assesmentCompleted.Score = answerViewModel.Answer == "2" ? 100 : 0; _eventBus.Publish(assesmentCompleted); }
public void CoOrdinates(AnswerViewModel answerViewModel) { var assesmentCompleted = new AssesmentCompleted { SubjectId = 1002, TopicId = 10023, StartDate = answerViewModel.StartDate, CompletedDate = DateTime.Now, PassThreshold = 100, Score = 100, StudentId = 1, TopicName = "Alternate coordinate systems (bases)" }; assesmentCompleted.Score = answerViewModel.Answer == "3" ? 100 : 0; _eventBus.Publish(assesmentCompleted); }
public void Vectors(AnswerViewModel answerViewModel) { var assesmentCompleted = new AssesmentCompleted { SubjectId = 1002, TopicId = 10021, StartDate = answerViewModel.StartDate, CompletedDate = DateTime.Now, PassThreshold = 100, Score = 100, StudentId = 1, TopicName = "Vectors and spaces" }; assesmentCompleted.Score = answerViewModel.Answer == "144" ? 100 : 0; _eventBus.Publish(assesmentCompleted); }