本文整理汇总了C#中BaseRepository.Save方法的典型用法代码示例。如果您正苦于以下问题:C# BaseRepository.Save方法的具体用法?C# BaseRepository.Save怎么用?C# BaseRepository.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseRepository
的用法示例。
在下文中一共展示了BaseRepository.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save_with_caching_enabled_expect_CachePurged
public void Save_with_caching_enabled_expect_CachePurged()
{
_config.EnableCaching = true;
var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();
storageHelper.Stub(h => h.SaveObject(FakeObject.Instance));
var cacheHelper = MockRepository.GenerateStub<ICacheHelper<FakeObject>>();
var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper, CacheHelper = cacheHelper };
repo.Save(FakeObject.Instance);
cacheHelper.AssertWasCalled(c => c.PurgeCacheItems());
}
示例2: Save_with_empty_Guid_expect_NewGuid
public void Save_with_empty_Guid_expect_NewGuid()
{
var newInstance = new FakeObject();
_config.EnableCaching = false;
var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();
storageHelper.Stub(h => h.SaveObject(null));
var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper };
repo.Save(newInstance);
Assert.AreNotEqual(newInstance.Id, Guid.Empty);
}
示例3: Save_expect_call_StorageHelper_SaveObject
public void Save_expect_call_StorageHelper_SaveObject()
{
_config.EnableCaching = false;
var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();
storageHelper.Stub(h => h.SaveObject(null));
var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper };
repo.Save(FakeObject.Instance);
storageHelper.AssertWasCalled(h => h.SaveObject(FakeObject.Instance));
}