public void TestGet() { // Arrange: var administrator = AdministratorHelper.GetNewValidAdministrator(); var queryOverMock = new QueryOverMock <Administrator>(new List <Administrator> { administrator }); var sessionMock = new Mock <ISession>(); sessionMock.Setup(x => x.QueryOver <Administrator>()).Returns(queryOverMock); var target = RepositoryHelper.Get <AdministratorRepository, Administrator>(sessionMock); // Act: var actualAdministrator = target.Get(administrator.UserName, administrator.Password); // Assert: Assert.AreEqual(administrator, actualAdministrator); }
public static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!AdministratorHelper.IsAdmin) { switch (new NotElevatedWarningDialog().Show()) { case Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult.Yes: AdministratorHelper.RestartAsAdmin(); break; case Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult.No: break; case Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult.Cancel: return; default: throw new ArgumentOutOfRangeException("NotElevatedWarningDialog.Show"); } } using (var pi = new ProcessIcon(new Program())) { if (pi.Display()) { Application.Run(); } } } catch (Exception exception) { new GeneralErrorDialog(exception).Show(); } }
public void UniqueNameTest() { // Arrange: Session.Save(AdministratorHelper.GetNewValidAdministrator("DuplicateUserName")); Session.Save(AdministratorHelper.GetNewValidAdministrator("DuplicateUserName")); }