本文整理汇总了C#中Rhino.Mocks.MockRepository.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.Verify方法的具体用法?C# MockRepository.Verify怎么用?C# MockRepository.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Mocks.MockRepository
的用法示例。
在下文中一共展示了MockRepository.Verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze_WhenExceptionThrown_EmailIsSent
public void Analyze_WhenExceptionThrown_EmailIsSent()
{
var mocks = new MockRepository();
var stubWebService = mocks.Stub<IWebService>();
var mockEmailSender = mocks.DynamicMock<IEmailSender>();
using (mocks.Record())
{
stubWebService.LogError("Anything");
LastCall.Constraints(Is.Anything());
LastCall.Throw(new Exception("Fake Exception"));
mockEmailSender.SendEmail("to", "subject", "Fake Exception");
}
var logAnalyzer = new LogAnalyzer
{
EmailSender = mockEmailSender,
WebService = stubWebService
};
logAnalyzer.Analyze("abc.txt");
mocks.Verify(mockEmailSender);
}
示例2: ClearEntriesForDirectory
public void ClearEntriesForDirectory()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IFilesStorageProviderV30 filesProv = mocks.DynamicMock<IFilesStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
string dirName = Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(filesProv, "/Dir/Sub/");
Expect.Call(aclManager.DeleteEntriesForResource(dirName)).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
AuthWriter.ClearEntriesForDirectory(filesProv, "/Dir/Sub/");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例3: MockRepository
public void Undo_Test_기존에_입력된_내용이_없을때()
{
MockRepository mocks= new MockRepository();
ICommandListener listener= mocks.DynamicMock<myInfoController>();
myInfo mi= mocks.Stub<myInfo>();
MyInfoInsertUpdateCommand myIUCMD = new MyInfoInsertUpdateCommand(mi,listener);
myIUCMD.preMyInfo = null;
using(mocks.Record())
{
listener.Delete(mi);
}
myIUCMD.Undo();
mocks.Verify(listener);
}
示例4: MockRepository
public void execute_업데이트과정_정상적으로_거치는지_검증()
{
MockRepository mocks = new MockRepository();
UserInfo stubData = mocks.Stub<UserInfo>();
stubData.id = "id";
stubData.password = "password";
ICommandListener mockListener = mocks.DynamicMock<UserAuthController>();
UpdateUserInfo uui = new UpdateUserInfo(stubData, mockListener);
using (mocks.Record())
{
mockListener.Select(stubData);
mockListener.Update(stubData,stubData);
LastCall.Return(true);
}
uui.execute();
mocks.Verify(mockListener);
}
示例5: Init_Upgrade
public void Init_Upgrade()
{
string testDir = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), Guid.NewGuid().ToString());
Directory.CreateDirectory(testDir);
MockRepository mocks = new MockRepository();
IHostV30 host = mocks.DynamicMock<IHostV30>();
Expect.Call(host.GetSettingValue(SettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce();
Expect.Call(host.GetSettingValue(SettingName.AdministratorsGroup)).Return("Administrators").Repeat.Once();
Expect.Call(host.GetSettingValue(SettingName.UsersGroup)).Return("Users").Repeat.Once();
Expect.Call(host.UpgradeSecurityFlagsToGroupsAcl(null, null)).IgnoreArguments().Repeat.Times(1).Return(true);
mocks.Replay(host);
string file = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Users.cs");
File.WriteAllText(file, "user|PASSHASH|[email protected]|Inactive|2008/10/31 15:15:15|USER\r\nsuperuser|SUPERPASSHASH|[email protected]|Active|2008/10/31 15:15:16|ADMIN");
UsersStorageProvider prov = new UsersStorageProvider();
prov.Init(host, "");
UserInfo[] users = prov.GetUsers();
Assert.AreEqual(2, users.Length, "Wrong user count");
Assert.AreEqual("superuser", users[0].Username, "Wrong username");
Assert.AreEqual("[email protected]", users[0].Email, "Wrong email");
Assert.IsTrue(users[0].Active, "User should be active");
Assert.AreEqual("2008/10/31 15:15:16", users[0].DateTime.ToString("yyyy'/'MM'/'dd' 'HH':'mm':'ss"), "Wrong date/time");
Assert.AreEqual(1, users[0].Groups.Length, "Wrong user count");
Assert.AreEqual("Administrators", users[0].Groups[0], "Wrong group");
Assert.AreEqual("user", users[1].Username, "Wrong username");
Assert.AreEqual("[email protected]", users[1].Email, "Wrong email");
Assert.IsFalse(users[1].Active, "User should be inactive");
Assert.AreEqual("2008/10/31 15:15:15", users[1].DateTime.ToString("yyyy'/'MM'/'dd' 'HH':'mm':'ss"), "Wrong date/time");
Assert.AreEqual(1, users[1].Groups.Length, "Wrong user count");
Assert.AreEqual("Users", users[1].Groups[0], "Wrong group");
mocks.Verify(host);
Directory.Delete(testDir, true);
}
示例6: Analyze_ShortFileName_LogsError
public void Analyze_ShortFileName_LogsError()
{
var mocks = new MockRepository();
var mockWebService = mocks.DynamicMock<IWebService>();
using (mocks.Record())
{
mockWebService.LogError("Short FileName:abc.txt");
}
var logAnalyzer = new LogAnalyzer
{
WebService = mockWebService
};
logAnalyzer.Analyze("abc.txt");
mocks.Verify(mockWebService);
}
示例7: MockRepository
public void execute_Test_정상적으로입력_Return_True()
{
//Arrange
MockRepository mocks = new MockRepository();
object uInfo = null;
UserInfo LoginInfo=mocks.Stub<UserInfo>();
LoginInfo.id = "id";
LoginInfo.password = "password";
ICommandListener mockCMDListener = mocks.DynamicMock<UserAuthController>();
Login login = new Login(mockCMDListener, LoginInfo);
using (mocks.Record())
{
mockCMDListener.Select(LoginInfo);
}
//Act
bool isOK = login.execute(out uInfo);
//Assert
mocks.Verify(mockCMDListener);
}
示例8: MockRepository
public void execute_Out타입_파라미터_있는_메서드_Test_정상적으로_로직_실행_하는지()
{
MockRepository mocks = new MockRepository();
InstanceContext ClientCallback = mocks.Stub<InstanceContext>();
ISQLWebService stubService = mocks.Stub<SQLWebServiceClient>(new object[] {ClientCallback});
IDataModel dbModel = mocks.Stub<SQLDataServiceModel>();
((SQLDataServiceModel)dbModel).sqlService = stubService;
((SQLDataServiceModel)dbModel).EncryptionSeed = "1234";
IDataQueryRepository SQLQueryHouse= mocks.Stub<SQLDataQueryRepository>();
IDataModel localDataModel = mocks.Stub<LocalDataFileService>();
IDataQueryRepository localQueryHouse = mocks.Stub<LocalDataQueryRepository>();
object[] paramList = { dbModel,localDataModel,SQLQueryHouse,localQueryHouse};
ICommandListener mockCMDListener = mocks.Stub<WorkInfoController>(paramList);
WorkInfoSelectCommand selectCommand = new WorkInfoSelectCommand(mockCMDListener);
object returnValue = new object();
using (mocks.Record())
{
selectCommand.execute(out returnValue);
}
mocks.Verify(mockCMDListener);
}
示例9: SetPermissionForPage_User_Grant
public void SetPermissionForPage_User_Grant()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
Expect.Call(aclManager.StoreEntry(Actions.ForPages.ResourceMasterPrefix + "Page",
Actions.ForPages.ModifyPage, "U.User", Value.Grant)).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
Assert.IsTrue(AuthWriter.SetPermissionForPage(AuthStatus.Grant, new PageInfo("Page", null, DateTime.Now),
Actions.ForPages.ModifyPage, new UserInfo("User", "User", "[email protected]", true, DateTime.Now, null)),
"SetPermissionForPage should return true");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例10: ProcessDirectoryRenaming
public void ProcessDirectoryRenaming()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IFilesStorageProviderV30 filesProv = MockFilesProvider();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
Expect.Call(aclManager.RenameResource(
Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(filesProv, "/Dir/"),
Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(filesProv, "/Dir2/"))).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
Assert.IsTrue(AuthWriter.ProcessDirectoryRenaming(filesProv, "/Dir/", "/Dir2/"), "ProcessDirectoryRenaming should return true");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例11: RetrieveSubjectsForDirectory_Root
public void RetrieveSubjectsForDirectory_Root()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IFilesStorageProviderV30 filesProv = mocks.DynamicMock<IFilesStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
string dirName = Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(filesProv, "/");
Expect.Call(aclManager.RetrieveEntriesForResource(dirName)).Return(
new AclEntry[] {
new AclEntry(dirName, Actions.ForDirectories.List, "U.User1", Value.Grant),
new AclEntry(dirName, Actions.ForDirectories.UploadFiles, "U.User", Value.Grant),
new AclEntry(dirName, Actions.ForDirectories.DownloadFiles, "G.Group", Value.Grant),
new AclEntry(dirName, Actions.ForDirectories.CreateDirectories, "U.User", Value.Deny) });
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
SubjectInfo[] infos = AuthReader.RetrieveSubjectsForDirectory(filesProv, "/");
Assert.AreEqual(3, infos.Length, "Wrong info count");
Array.Sort(infos, delegate(SubjectInfo x, SubjectInfo y) { return x.Name.CompareTo(y.Name); });
Assert.AreEqual("Group", infos[0].Name, "Wrong subject name");
Assert.AreEqual(SubjectType.Group, infos[0].Type, "Wrong subject type");
Assert.AreEqual("User", infos[1].Name, "Wrong subject name");
Assert.AreEqual(SubjectType.User, infos[1].Type, "Wrong subject type");
Assert.AreEqual("User1", infos[2].Name, "Wrong subject name");
Assert.AreEqual(SubjectType.User, infos[2].Type, "Wrong subject type");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例12: MockRepository
public void execute_Test_정상적인_값을_파라미터로_주고_정상적으로_입력되는지()
{
MockRepository mocks = new MockRepository();
UserInfo data= mocks.Stub<UserInfo>();
ICommandListener mockCommandListener= mocks.DynamicMock<UserAuthController>();
MakeAuth MakeUserCommand = new MakeAuth(data, mockCommandListener);
using (mocks.Record())
{
data.id = "id";
data.password = "password";
data.userAuth = "userAuth";
data.userType = 사용자등급.일반사용자;
mockCommandListener.Insert(data);
LastCall.Return(true);
}
MakeUserCommand.execute();
mocks.Verify(mockCommandListener);
}
示例13: SetPermissionForDirectory_User_Grant
public void SetPermissionForDirectory_User_Grant()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IFilesStorageProviderV30 filesProv = mocks.DynamicMock<IFilesStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
Expect.Call(aclManager.StoreEntry(
Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(filesProv, "/"),
Actions.ForDirectories.DownloadFiles, "U.User", Value.Grant)).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
Assert.IsTrue(AuthWriter.SetPermissionForDirectory(AuthStatus.Grant, filesProv, "/", Actions.ForDirectories.DownloadFiles,
new UserInfo("User", "User", "[email protected]", true, DateTime.Now, null)),
"SetPermissionForDirectory should return true");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例14: RemoveEntriesForPage_User
public void RemoveEntriesForPage_User()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
Expect.Call(aclManager.RetrieveEntriesForSubject("U.User")).Return(
new AclEntry[] {
new AclEntry(Actions.ForPages.ResourceMasterPrefix + "Page", Actions.ForPages.ManagePage, "U.User", Value.Grant),
new AclEntry(Actions.ForPages.ResourceMasterPrefix + "Page", Actions.ForPages.ManageCategories, "U.User", Value.Deny),
new AclEntry(Actions.ForPages.ResourceMasterPrefix + "Sub.Page", Actions.ForPages.ManagePage, "U.User", Value.Grant),
new AclEntry(Actions.ForGlobals.ResourceMasterPrefix, Actions.ForGlobals.ManageNavigationPaths, "U.User", Value.Grant) });
Expect.Call(aclManager.DeleteEntry(Actions.ForPages.ResourceMasterPrefix + "Page",
Actions.ForPages.ManagePage, "U.User")).Return(true);
Expect.Call(aclManager.DeleteEntry(Actions.ForPages.ResourceMasterPrefix + "Page",
Actions.ForPages.ManageCategories, "U.User")).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
Assert.IsTrue(AuthWriter.RemoveEntriesForPage(new UserInfo("User", "User", "[email protected]", true, DateTime.Now, null),
new PageInfo("Page", null, DateTime.Now)), "RemoveEntriesForPage should return true");
mocks.Verify(prov);
mocks.Verify(aclManager);
}
示例15: RemoveEntriesForNamespace_Group_Sub
public void RemoveEntriesForNamespace_Group_Sub()
{
MockRepository mocks = new MockRepository();
ISettingsStorageProviderV30 prov = mocks.DynamicMock<ISettingsStorageProviderV30>();
IAclManager aclManager = mocks.DynamicMock<IAclManager>();
Expect.Call(prov.AclManager).Return(aclManager).Repeat.Any();
Expect.Call(aclManager.RetrieveEntriesForSubject("G.Group")).Return(
new AclEntry[] {
new AclEntry(Actions.ForNamespaces.ResourceMasterPrefix + "Sub", Actions.ForNamespaces.ManagePages, "G.Group", Value.Grant),
new AclEntry(Actions.ForNamespaces.ResourceMasterPrefix + "Sub", Actions.ForNamespaces.ManageCategories, "G.Group", Value.Grant),
new AclEntry(Actions.ForNamespaces.ResourceMasterPrefix, Actions.ForNamespaces.ModifyPages, "G.Group", Value.Grant),
new AclEntry(Actions.ForGlobals.ResourceMasterPrefix, Actions.ForGlobals.ManageNavigationPaths, "G.Group", Value.Grant) });
Expect.Call(aclManager.DeleteEntry(Actions.ForNamespaces.ResourceMasterPrefix + "Sub",
Actions.ForNamespaces.ManagePages, "G.Group")).Return(true);
Expect.Call(aclManager.DeleteEntry(Actions.ForNamespaces.ResourceMasterPrefix + "Sub",
Actions.ForNamespaces.ManageCategories, "G.Group")).Return(true);
mocks.Replay(prov);
mocks.Replay(aclManager);
Collectors.SettingsProvider = prov;
Assert.IsTrue(AuthWriter.RemoveEntriesForNamespace(new UserGroup("Group", "Group", null), new NamespaceInfo("Sub", null, null)), "RemoveEntriesForNamespace should return true");
mocks.Verify(prov);
mocks.Verify(aclManager);
}