public void ShouldSaveDataModelToMongoLab() { // Arrage var bsonBinaryData = new BsonBinaryData(_imageConverter.Convert(Image.FromFile("C:\\dev\\Phillip Buttrose\\Guitars\\Web\\assets\\about\\images\\DSC_0168.JPG"))); var dataModel = new AboutDataModel { Title = "Phillip J Buttrose Pty Ltd", SubTitle = "Phillip Buttrose - Luthier", Image = bsonBinaryData, Description = new List <string> { "Phillip has recently retired from a working life of farming, the military and the construction industry.", "He has settled in the hills above Perth in Western Australia, and working alone in his small workshop builds just a handful of handcrafted classical guitars a year.", "Inspired by the Ignacio Feta\u2019s 1962-67 guitars and handcrafted from Australian native tone woods, these guitars have brilliant bell like trebles and balanced clear deep base tones. The guitars require a gentle action to achieve excellent volume with exceptional sustain." }, TwitterUrl = "https://twitter.com/PhillipButtrose", FacebookUrl = "https://www.facebook.com/pages/Phillip-J-Buttrose/355734807900191", LinkedInUrl = "http://www.linkedin.com/profile/view?id=327250818&locale=en_US&trk=tyah&trkInfo=tas%3Aphillip%2Cidx%3A2-3-4", GooglePlusUrl = "https://plus.google.com/113144916347440280117/posts" }; var savedDataModel = dataModel.Clone(); savedDataModel._id = new ObjectId(); _mongoDbProvider.Update("about", dataModel).Returns(dataModel); // Act var updatedModel = _repositoryUnderTest.Save(dataModel); // Assert Assert.That(updatedModel._id, Is.EqualTo(savedDataModel._id)); Assert.That(updatedModel.Title, Is.EqualTo(dataModel.Title)); }
public void ShouldSaveDataModelToMongoLab() { // Arrange var contactDataModel = new ContactDataModel(); _mongoDbProvider.Update <ContactDataModel>("contact", contactDataModel).Returns(contactDataModel); // Act var result = _repositoryUnderTest.Save(contactDataModel); // Assert Assert.That(result, Is.EqualTo(contactDataModel)); }
public void ShouldSaveDataModelToMongoLab() { // Arrange var portfolioDataModel = new PortfolioDataModel(); _mongoDbProvider.Update <PortfolioDataModel>("portfolio", portfolioDataModel).Returns(portfolioDataModel); // Act var result = _repositoryUnderTest.Save(portfolioDataModel); // Assert Assert.That(result, Is.EqualTo(portfolioDataModel)); }
public T Save(T dataModel) { return(_mongoDbProvider.Update(_collectionName, dataModel)); }