Using the new built in testing for Active Record (set "Test" as the connection string) I've hit a problem performing an update.
The code I'm testing pulls an existing object out of the database, makes some changes to it, and then saves it.
public void SaveProduct(string productId) {
var dbProduct = Model.Generated.Product.SingleOrDefault(x => x.ProductID == productId);
dbProduct.Description = "Description";
dbProduct.Price = "Price";
dbProduct.Save();
}
To test this, I'm creating a new list of products, with one product in it.
_dbProducts = new List<Product>
{
new Product
{
ProductID = "XXX0001"
}
};
Then I set up the test (fake).
Product.Setup(_dbProducts)
call the save method
repository.SaveProduct("XXX0001");
The problem is I'm getting the following error message...
System.NotImplementedException: The method or operation is not implemented. at SubSonic.Repository.TestRepository`1.Add(T item, IDataProvider provider) at Model.Generated.Product.Add(IDataProvider provider) in ActiveRecord.cs: line 708 at Model.Generated.Product.Save(IDataProvider provider) in ActiveRecord.cs: line 721 at Model.Generated.Product.Save() in ActiveRecord.cs: line 715 at Subsonic.PDAJobRepository.SaveProduct() in ProductRepository.cs: line 46 at Tests.ProductRepository.When_Saving_Product.Setup() in When_Saving_Product.cs: line 44