public void ShouldCallInsertForTheFormEventSentIn() { // Arrange var formEvent = new FormEvent(); var formEventDataModel = new FormEventDataModel(); _entityMapper.Expect(x => x.Map<FormEventDataModel>(formEvent)).Return(formEventDataModel); _mongoDbProxy.Expect(x => x.Insert(FormEventRepository.COLLECTION_NAME, new[] { formEventDataModel })); _mockRepository.ReplayAll(); // Act _formEventRepository.Insert(formEvent); // Assert _mockRepository.VerifyAll(); }
public void PlayingWithSearches() { /*{ "_id" : ObjectId("4fa7341d393751187ca8d053"), "VisitGuid" : BinData(3,"NFQW3oo GxEiNj3e99NQRSg=="), "Url" : "http://*****:*****@" function() { emit(1, { id: this.VisitGuid + this.ElementId} ); }"), new BsonJavaScript( @" function(key, values) { var sum = 0; values.forEach(function(prev) { sum += prev; }); return sum; }")); var queryComplete = Query.And( Query.EQ("ElementId", "StringValue"), Query.EQ("ElementType", "text") ); // Act var elements = _mongoDbProxy.MongoDatabase .GetCollection<FormEventDataModel>(_collectionName) .Find(queryComplete); // Assert foreach (var x in elements) { var ninja = x; } }