public void SigparseNoArg() { sp.Parse("void zzz()"); Assert.IsNotNull(sp.Signature.Arguments); Assert.AreEqual(0, sp.Signature.Arguments.Length); }
public void GetLinksTest() { var results = SqlUtils.GetLinks("72a33ebb-3efe-455b-9e41-0733aaed7780"); Assert.IsNotNull(results); }
private TestResult VerifyProjectInformation(Application application, Log log) { const string prefix = "Project information"; var result = new TestResult(); var assert = new Assert(result, log); try { // Start new project via File menu var projectPage = TabProxies.GetProjectPageTabItem(application, log); if (projectPage == null) { MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log); } projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNotNull(projectPage, prefix + " - The project page was not opened."); // Set a name var name = "Project-Test-Name"; ProjectPageControlProxies.ProjectName(application, log, name); var storedName = ProjectPageControlProxies.ProjectName(application, log); assert.AreEqual(name, storedName, prefix + " - The written project name does not match the stored project name."); // Set a summary var summary = "Project-Test-Summary"; ProjectPageControlProxies.ProjectSummary(application, log, summary); var storedSummary = ProjectPageControlProxies.ProjectSummary(application, log); assert.AreEqual(summary, storedSummary, prefix + " - The written project summary does not match the stored project summary."); // Set focus away from the text control so that the changes 'stick' by clicking somewhere, in this case the project tab item. projectPage.Click(); // Undo MenuProxies.UndoViaEditMenu(application, log); storedName = ProjectPageControlProxies.ProjectName(application, log); assert.AreEqual(name, storedName, prefix + " - The project name change was undone too early."); storedSummary = ProjectPageControlProxies.ProjectSummary(application, log); assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone."); // Undo MenuProxies.UndoViaEditMenu(application, log); storedName = ProjectPageControlProxies.ProjectName(application, log); assert.IsTrue(string.IsNullOrEmpty(storedName), prefix + " - The change to the project name was not undone."); storedSummary = ProjectPageControlProxies.ProjectSummary(application, log); assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone."); // Redo MenuProxies.RedoViaEditMenu(application, log); storedName = ProjectPageControlProxies.ProjectName(application, log); assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone."); storedSummary = ProjectPageControlProxies.ProjectSummary(application, log); assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was redone too early."); // Redo MenuProxies.RedoViaEditMenu(application, log); storedName = ProjectPageControlProxies.ProjectName(application, log); assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone."); storedSummary = ProjectPageControlProxies.ProjectSummary(application, log); assert.AreEqual(summary, storedSummary, prefix + " - The change to the project summary was not redone."); } catch (RegressionTestFailedException e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }
public void ContactFormSaysThanks() { var homeControler = new HomeController(); var result = homeControler.Contact("Test") as PartialViewResult; Assert.IsNotNull(result.ViewBag.Message); }
public void GetResultsTest() { var results = SqlUtils.GetResults(); Assert.IsNotNull(results); }
/// <summary> /// Verifies that the 'View' menu works as expected. /// </summary> /// <param name="application">The application.</param> /// <param name="log">The log object.</param> /// <returns>The test result for the current test case.</returns> public TestResult VerifyViewMenu(Application application, Log log) { const string prefix = "View menu"; var result = new TestResult(); var assert = new Assert(result, log); try { var startPage = TabProxies.GetStartPageTabItem(application, log); if (startPage != null) { log.Info(prefix, "Closing start page."); TabProxies.CloseStartPageTab(application, log); } // Make sure we don't close the welcome tab upon opening the project page WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log); var projectPage = TabProxies.GetProjectPageTabItem(application, log); if (projectPage != null) { log.Info(prefix, "Closing project page."); TabProxies.CloseProjectPageTab(application, log); } // Open start page via view menu MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log); startPage = TabProxies.GetStartPageTabItem(application, log); assert.IsNotNull(startPage, prefix + " - Check start page exists after clicking start page menu item"); assert.IsTrue(startPage.IsSelected, prefix + " - Check start page is focussed after clicking start page menu item"); } catch (RegressionTestFailedException e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }
public void Test_Teem_Been_Init_And_HasData() { Assert.IsNotNull(stage.InitTeem); }
public void MachineConfigurationDirectory_Deny_FileIOPermission () { Assert.IsNotNull (HttpRuntime.MachineConfigurationDirectory, "MachineConfigurationDirectory"); }
public void PermitOnly_PathDiscovery () { string s = HttpRuntime.AspInstallDirectory; // null in unit tests for mono Assert.IsNotNull (HttpRuntime.ClrInstallDirectory, "ClrInstallDirectory"); Assert.IsNotNull (HttpRuntime.MachineConfigurationDirectory, "MachineConfigurationDirectory"); }
public void TestPusher() { var remote = GetReplicationURL(); var docIdTimestamp = Convert.ToString(Runtime.CurrentTimeMillis()); // Create some documents: var documentProperties = new Dictionary <string, object>(); var doc1Id = string.Format("doc1-{0}", docIdTimestamp); documentProperties["_id"] = doc1Id; documentProperties["foo"] = 1; documentProperties["bar"] = false; var body = new Body(documentProperties); var rev1 = new RevisionInternal(body, database); var status = new Status(); rev1 = database.PutRevision(rev1, null, false, status); Assert.AreEqual(StatusCode.Created, status.GetCode()); documentProperties.Put("_rev", rev1.GetRevId()); documentProperties["UPDATED"] = true; database.PutRevision(new RevisionInternal(documentProperties, database), rev1.GetRevId(), false, status); Assert.AreEqual(StatusCode.Created, status.GetCode()); documentProperties = new Dictionary <string, object>(); var doc2Id = string.Format("doc2-{0}", docIdTimestamp); documentProperties["_id"] = doc2Id; documentProperties["baz"] = 666; documentProperties["fnord"] = true; database.PutRevision(new RevisionInternal(documentProperties, database), null, false, status); Assert.AreEqual(StatusCode.Created, status.GetCode()); var doc2 = database.GetDocument(doc2Id); var doc2UnsavedRev = doc2.CreateRevision(); var attachmentStream = GetAsset("attachment.png"); doc2UnsavedRev.SetAttachment("attachment.png", "image/png", attachmentStream); var doc2Rev = doc2UnsavedRev.Save(); Assert.IsNotNull(doc2Rev); const bool continuous = false; var repl = database.CreatePushReplication(remote); repl.Continuous = continuous; if (!IsSyncGateway(remote)) { repl.CreateTarget = true; } // Check the replication's properties: Assert.AreEqual(database, repl.LocalDatabase); Assert.AreEqual(remote, repl.RemoteUrl); Assert.IsFalse(repl.IsPull); Assert.IsFalse(repl.Continuous); Assert.IsNull(repl.Filter); Assert.IsNull(repl.FilterParams); Assert.IsNull(repl.DocIds); // TODO: CAssertNil(r1.headers); still not null! // Check that the replication hasn't started running: Assert.IsFalse(repl.IsRunning); Assert.AreEqual((int)repl.Status, (int)ReplicationStatus.Stopped); Assert.AreEqual(0, repl.CompletedChangesCount); Assert.AreEqual(0, repl.ChangesCount); Assert.IsNull(repl.LastError); RunReplication(repl); // TODO: Verify the foloowing 2 asserts. ChangesCount and CompletedChangesCount // should already be reset when the replicator stopped. Assert.IsTrue(repl.ChangesCount >= 2); Assert.IsTrue(repl.CompletedChangesCount >= 2); Assert.IsNull(repl.LastError); VerifyRemoteDocExists(remote, doc1Id); // Add doc3 documentProperties = new Dictionary <string, object>(); var doc3Id = string.Format("doc3-{0}", docIdTimestamp); var doc3 = database.GetDocument(doc3Id); documentProperties["bat"] = 677; doc3.PutProperties(documentProperties); // re-run push replication var repl2 = database.CreatePushReplication(remote); repl2.Continuous = continuous; if (!IsSyncGateway(remote)) { repl2.CreateTarget = true; } var repl2CheckedpointId = repl2.RemoteCheckpointDocID(); RunReplication(repl2); Assert.IsNull(repl2.LastError); // make sure trhe doc has been added VerifyRemoteDocExists(remote, doc3Id); Assert.AreEqual(repl2.LastSequence, database.LastSequenceWithCheckpointId(repl2CheckedpointId)); System.Threading.Thread.Sleep(2000); var json = GetRemoteDoc(remote, repl2CheckedpointId); var remoteLastSequence = (string)json["lastSequence"]; Assert.AreEqual(repl2.LastSequence, remoteLastSequence); Log.D(Tag, "testPusher() finished"); }
public void ClrInstallDirectory_Deny_FileIOPermission () { Assert.IsNotNull (HttpRuntime.ClrInstallDirectory, "ClrInstallDirectory"); }
public void TestPushPurgedDoc() { var numBulkDocRequests = 0; HttpRequestMessage lastBulkDocsRequest = null; var doc = CreateDocumentWithProperties( database, new Dictionary <string, object> { { "testName", "testPurgeDocument" } } ); Assert.IsNotNull(doc); var remote = GetReplicationURL(); var factory = new MockHttpClientFactory(); factory.HttpHandler.ClearResponders(); factory.HttpHandler.AddResponderRevDiffsAllMissing(); factory.HttpHandler.AddResponderFakeLocalDocumentUpdate404(); factory.HttpHandler.AddResponderFakeBulkDocs(); manager.DefaultHttpClientFactory = factory; var pusher = database.CreatePushReplication(remote); pusher.Continuous = true; var replicationCaughtUpSignal = new CountdownEvent(1); pusher.Changed += (sender, e) => { var changesCount = e.Source.ChangesCount; var completedChangesCount = e.Source.CompletedChangesCount; var msg = "changes: {0} completed changes: {1}".Fmt(changesCount, completedChangesCount); Log.D(Tag, msg); if (changesCount == completedChangesCount && changesCount != 0 && replicationCaughtUpSignal.CurrentCount > 0) { replicationCaughtUpSignal.Signal(); } }; pusher.Start(); // wait until that doc is pushed var didNotTimeOut = replicationCaughtUpSignal.Wait(TimeSpan.FromSeconds(5)); Assert.IsTrue(didNotTimeOut); // at this point, we should have captured exactly 1 bulk docs request numBulkDocRequests = 0; var handler = factory.HttpHandler; foreach (var capturedRequest in handler.CapturedRequests) { if (capturedRequest.Method == HttpMethod.Post && capturedRequest.RequestUri.AbsoluteUri.EndsWith("_bulk_docs", StringComparison.Ordinal)) { lastBulkDocsRequest = capturedRequest; numBulkDocRequests++; } } Assert.AreEqual(1, numBulkDocRequests); // that bulk docs request should have the "start" key under its _revisions var jsonMap = MockHttpRequestHandler.GetJsonMapFromRequest(lastBulkDocsRequest); var docs = ((JArray)jsonMap.Get("docs")).ToObject <IList <IDictionary <string, object> > >(); var onlyDoc = docs[0]; var revisions = ((JObject)onlyDoc.Get("_revisions")).ToObject <IDictionary <string, object> >(); Assert.IsTrue(revisions.ContainsKey("start")); // Reset for the next attempt. handler.ClearCapturedRequests(); // now add a new revision, which will trigger the pusher to try to push it var properties = new Dictionary <string, object>(); properties.Put("testName2", "update doc"); var unsavedRevision = doc.CreateRevision(); unsavedRevision.SetUserProperties(properties); unsavedRevision.Save(); // but then immediately purge it doc.Purge(); // wait for a while to give the replicator a chance to push it // (it should not actually push anything) System.Threading.Thread.Sleep(5 * 1000); // we should not have gotten any more _bulk_docs requests, because // the replicator should not have pushed anything else. // (in the case of the bug, it was trying to push the purged revision) numBulkDocRequests = 0; foreach (var capturedRequest in handler.CapturedRequests) { if (capturedRequest.Method == HttpMethod.Post && capturedRequest.RequestUri.AbsoluteUri.EndsWith("_bulk_docs", StringComparison.Ordinal)) { numBulkDocRequests++; } } Assert.AreEqual(1, numBulkDocRequests); pusher.Stop(); }
public void TestPushReplicationCanMissDocs() { Assert.AreEqual(0, database.LastSequenceNumber); var properties1 = new Dictionary <string, object>(); properties1["doc1"] = "testPushReplicationCanMissDocs"; var doc1 = CreateDocumentWithProperties(database, properties1); var properties2 = new Dictionary <string, object>(); properties2["doc2"] = "testPushReplicationCanMissDocs"; var doc2 = CreateDocumentWithProperties(database, properties2); var doc2UnsavedRev = doc2.CreateRevision(); var attachmentStream = GetAsset("attachment.png"); doc2UnsavedRev.SetAttachment("attachment.png", "image/png", attachmentStream); var doc2Rev = doc2UnsavedRev.Save(); Assert.IsNotNull(doc2Rev); var httpClientFactory = new MockHttpClientFactory(); manager.DefaultHttpClientFactory = httpClientFactory; var httpHandler = httpClientFactory.HttpHandler; httpHandler.AddResponderFakeLocalDocumentUpdate404(); var json = "{\"error\":\"not_found\",\"reason\":\"missing\"}"; MockHttpRequestHandler.HttpResponseDelegate bulkDocsResponder = (request) => { return(MockHttpRequestHandler.GenerateHttpResponseMessage(HttpStatusCode.NotFound, null, json)); }; httpHandler.SetResponder("_bulk_docs", bulkDocsResponder); MockHttpRequestHandler.HttpResponseDelegate doc2Responder = (request) => { var responseObject = new Dictionary <string, object>(); responseObject["id"] = doc2.Id; responseObject["ok"] = true; responseObject["rev"] = doc2.CurrentRevisionId; return(MockHttpRequestHandler.GenerateHttpResponseMessage(responseObject)); }; httpHandler.SetResponder(doc2.Id, bulkDocsResponder); var replicationDoneSignal = new CountDownLatch(1); var observer = new ReplicationObserver(replicationDoneSignal); var pusher = database.CreatePushReplication(GetReplicationURL()); pusher.Changed += observer.Changed; pusher.Start(); var success = replicationDoneSignal.Await(TimeSpan.FromSeconds(5)); Assert.IsTrue(success); Assert.IsNotNull(pusher.LastError); System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(500)); var localLastSequence = database.LastSequenceWithCheckpointId(pusher.RemoteCheckpointDocID()); Log.D(Tag, "dtabase.lastSequenceWithCheckpointId(): " + localLastSequence); Log.D(Tag, "doc2.getCUrrentRevision().getSequence(): " + doc2.CurrentRevision.Sequence); // Since doc1 failed, the database should _not_ have had its lastSequence bumped to doc2's sequence number. // If it did, it's bug: github.com/couchbase/couchbase-lite-java-core/issues/95 Assert.IsFalse(doc2.CurrentRevision.Sequence.ToString().Equals(localLastSequence)); Assert.IsNull(localLastSequence); Assert.IsTrue(doc2.CurrentRevision.Sequence > 0); }
public TestResult VerifyCloseOnProjectOpenCheckbox(Application application, Log log) { const string prefix = "Close welcome tab on project open"; var result = new TestResult(); var assert = new Assert(result, log); try { var startPage = TabProxies.GetStartPageTabItem(application, log); if (startPage == null) { log.Info(prefix, "Opening start page."); MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log); } startPage = TabProxies.GetStartPageTabItem(application, log); if (startPage == null) { var message = "Failed to get the start page."; log.Error(prefix, message); result.AddError(prefix + " - " + message); return result; } try { if (!startPage.IsSelected) { log.Info(prefix, "Setting focus to start page."); startPage.Select(); } } catch (Exception e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed to select the start page tab. Error was: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); return result; } // Check 'keep open' flag WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log); // New button var newProjectSearchCriteria = SearchCriteria .ByAutomationId(WelcomeViewAutomationIds.NewProject); var newProjectButton = (Button)startPage.Get(newProjectSearchCriteria); if (newProjectButton == null) { var message = "Failed to get the 'New Project' button."; log.Error(prefix, message); result.AddError(prefix + " - " + message); return result; } newProjectButton.Click(); // Check that the start page hasn't been closed var currentStartPage = TabProxies.GetStartPageTabItem(application, log); assert.IsNotNull(currentStartPage, prefix + " - Start page does not exist after opening project"); assert.IsFalse(currentStartPage.IsSelected, prefix + " - Start page is selected after opening project"); var currentProjectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNotNull(currentProjectPage, prefix + " - Project page does not exist after opening project"); assert.IsTrue(currentProjectPage.IsSelected, prefix + " - Project page is not selected after opening project"); // Check that File - close has been enabled var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log); assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled"); // HACK: It seems that the File menu stays open when we check the File - close menu item var fileMenu = MenuProxies.GetFileMenuItem(application, log); if (fileMenu == null) { var message = "Failed to get the file menu."; log.Error(prefix, message); result.AddError(prefix + " - " + message); return result; } if (fileMenu.IsFocussed) { fileMenu.Click(); } // Close the project via the close button on the tab page TabProxies.CloseProjectPageTab(application, log); WelcomePageControlProxies.CheckCloseWelcomePageOnProjectOpen(application, log); // New button newProjectButton.Click(); // Check that the start page has been closed currentStartPage = TabProxies.GetStartPageTabItem(application, log); assert.IsNull(currentStartPage, prefix + " - Start page exists after opening project"); // Close the project via the close button on the tab page TabProxies.CloseProjectPageTab(application, log); WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log); } catch (RegressionTestFailedException e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }
public void SPNameG_UseGroup_Test() { var cAction = new ActionGet<UserGroup>(new ActionAppUserGroup(_dataSource)); var sp = cAction.GetSPName("Read"); Assert.IsNotNull(sp); }
public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level) { ConstructorInfo ci = this.Type.GetConstructor (VoidType); Assert.IsNotNull (ci, "default .ctor"); return ci.Invoke (null); }
public void PalSupportsMd5() { var md5 = CryptoPal.Platform.Md5(); Assert.IsNotNull(md5); }
public void StaticProperties () { Assert.IsNull (HttpRuntime.AppDomainAppVirtualPath, "AppDomainAppVirtualPath"); Assert.IsNotNull (HttpRuntime.Cache, "Cache"); }
public SessionHolder(T session, ReplWindowProxy owner) { Assert.IsNotNull(session); Session = session; _owner = owner; }
public void Should_return_finishings() { Assert.IsNotNull(result); }
public void Test_ClassContructor() { Assert.IsNotNull(stage); }
private void RunPositiveFunctionTest(ODataFormat format, TestCase testCase) { // All of the functions tests use the PlaybackService since the WCF Data Services server doesn't support functions // The PlaybackService itself will not automatically turn Metadata into an absolute URI, so set that to false on all tests. // The tests also use absolute URIs for Target, so suppress that as well. testCase.AddBaseUriToMetadata = false; testCase.AddBaseUriToTarget = false; using (TestWebRequest request = TestWebRequest.CreateForInProcessWcf()) using (PlaybackService.ProcessRequestOverride.Restore()) { request.ServiceType = typeof(AstoriaUnitTests.Stubs.PlaybackService); request.StartService(); var payloadBuilder = testCase.ResponsePayloadBuilder; PlaybackService.ProcessRequestOverride.Value = (req) => { string contentType; if (format == ODataFormat.Json) { contentType = UnitTestsUtil.JsonLightMimeType; payloadBuilder.Metadata = request.BaseUri + "/$metadata#TestService.CustomerEntities/$entity"; } else { contentType = UnitTestsUtil.AtomFormat; } req.SetResponseStreamAsText(PayloadGenerator.Generate(payloadBuilder, format)); req.ResponseHeaders.Add("Content-Type", contentType); req.SetResponseStatusCode(200); return(req); }; testCase.AddBaseUriStringToExpectedDescriptors(request.ServiceRoot.OriginalString, format); Uri uri = new Uri(request.ServiceRoot + "/" + testCase.RequestUriString); DataServiceContext ctx = new DataServiceContext(request.ServiceRoot, ODataProtocolVersion.V4); ctx.EnableAtom = true; if (format == ODataFormat.Json) { string serviceEdmx = GetServiceEdmxWithOperations(payloadBuilder); JsonLightTestUtil.ConfigureContextForJsonLight(ctx, serviceEdmx); } QueryOperationResponse <CustomerEntity> qor = (QueryOperationResponse <CustomerEntity>)ctx.Execute <CustomerEntity>(uri); Assert.IsNotNull(qor); Assert.IsNull(qor.Error); IEnumerator <CustomerEntity> entities = qor.GetEnumerator(); int expectedDescriptorsPerEntity = 0; while (entities.MoveNext()) { CustomerEntity c = entities.Current; EntityDescriptor ed = ctx.GetEntityDescriptor(c); IEnumerable <OperationDescriptor> actualDescriptors = ed.OperationDescriptors; TestEquality(actualDescriptors, testCase.GetExpectedDescriptors(format)[expectedDescriptorsPerEntity++]); } } }
public void SimpleCrudTest() { var afterInsert = false; var afterUpdate = false; var afterDelete = false; DataStore.AddType<TestItem>(); DataStore.CreateOrUpdateStore(); DataStore.AfterInsert += delegate { afterInsert = true; }; DataStore.AfterUpdate += delegate { afterUpdate = true; }; DataStore.AfterDelete += delegate { afterDelete = true; }; var itemA = new TestItem("ItemA") { UUID = Guid.NewGuid(), ITest = 5, FTest = 3.14F, DBTest = 1.4D, DETest = 2.678M }; var itemB = new TestItem("ItemB"); var itemC = new TestItem("ItemC"); // INSERT DataStore.Insert(itemA); Assert.IsTrue(afterInsert, "AfterInsert never fired"); DataStore.Insert(itemB); DataStore.Insert(itemC); // COUNT var count = DataStore.Select<TestItem>().Count(); Assert.AreEqual(3, count); // SELECT var items = DataStore.Select<TestItem>().GetValues(); Assert.AreEqual(3, items.Count()); var condition = DataStore.Condition<TestItem>("Name", itemB.Name, FilterOperator.Equals); var item = DataStore.Select<TestItem, TestItem>().Where(condition).GetValues().First(); Assert.IsTrue(item.Equals(itemB)); item = DataStore.Select<TestItem>(3); Assert.IsTrue(item.Equals(itemC)); // FETCH // UPDATE itemC.Name = "NewItem"; itemC.Address = "Changed Address"; itemC.BigString = "little string"; // test rollback DataStore.BeginTransaction(); DataStore.Update(itemC); item = DataStore.Select<TestItem>(3); Assert.IsTrue(item.Name == itemC.Name); DataStore.Rollback(); item = DataStore.Select<TestItem>(3); Assert.IsTrue(item.Name != itemC.Name); // test commit DataStore.BeginTransaction(IsolationLevel.Unspecified); DataStore.Update(itemC); DataStore.Commit(); Assert.IsTrue(afterUpdate, "AfterUpdate never fired"); condition = DataStore.Condition<TestItem>("Name", "ItemC", FilterOperator.Equals); item = DataStore.Select<TestItem, TestItem>().Where(condition).GetValues().FirstOrDefault(); Assert.IsNull(item); condition = DataStore.Condition<TestItem>("Name", itemC.Name, FilterOperator.Equals); item = DataStore.Select<TestItem, TestItem>().Where(condition).GetValues().First(); Assert.IsTrue(item.Equals(itemC)); // DELETE DataStore.Delete(itemA); Assert.IsTrue(afterDelete, "AfterDelete never fired"); condition = DataStore.Condition<TestItem>("Name", itemA.Name, FilterOperator.Equals); item = DataStore.Select<TestItem, TestItem>().Where(condition).GetValues().FirstOrDefault(); Assert.IsNull(item); // COUNT count = DataStore.Select<TestItem>().Count(); Assert.AreEqual(2, count); // this will create the table in newer versions of ORM DataStore.AddType<LateAddItem>(); var newitems = DataStore.Select<LateAddItem>(); Assert.IsNotNull(newitems); }
public void publishes_start_message() { var startMessage = HandledMessages.OfType <CoreProjectionManagementMessage.Start>().LastOrDefault(); Assert.IsNotNull(startMessage); }
public void GetRecordsTest1() { var results = SqlUtils.GetRecords("72a33ebb-3efe-455b-9e41-0733aaed7780", "1"); Assert.IsNotNull(results); }
public static void ShouldNotBeNull <T>(this T itemToCheck) where T : class { Assert.IsNotNull(itemToCheck); }
private TestResult VerifyDatasetCreation(Application application, Log log) { const string prefix = "Dataset information"; var result = new TestResult(); var assert = new Assert(result, log); try { var projectPage = TabProxies.GetProjectPageTabItem(application, log); if (projectPage == null) { MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log); } projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNotNull(projectPage, prefix + " - The project page was not opened."); var datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); var datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs before creating sub-datasets."); ProjectPageControlProxies.CreateChildDatasetForRoot(application, log); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after creating 1 sub-dataset."); ProjectPageControlProxies.CreateChildDatasetForRoot(application, log); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after creating 2 sub-datasets."); // Undo MenuProxies.UndoViaEditMenu(application, log); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the second dataset."); // Undo MenuProxies.UndoViaEditMenu(application, log); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the first dataset."); // Redo MenuProxies.RedoViaEditMenu(application, log); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the first dataset."); // Redo MenuProxies.RedoViaEditMenu(application, log); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the second dataset."); // Delete first child var ids = new List<int>(datasetIds); ids.Sort(); ProjectPageControlProxies.DeleteDataset(application, log, ids[1]); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the first dataset."); assert.IsTrue(datasetIds.Contains(ids[2]), prefix + " - The second dataset was deleted but should not have been."); // Delete second child ProjectPageControlProxies.DeleteDataset(application, log, ids[2]); ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1); datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log); datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); assert.AreEqual( datasetIds.Count(), datasetCount, prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the second dataset."); } catch (RegressionTestFailedException e) { var message = string.Format(CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }
public async Task Details_GET_returns_BadRequest_when_provided_id_is_null() { var badRequestResult = await controller.Details(null) as BadRequestResult; Assert.IsNotNull(badRequestResult); }
private TestResult VerifyActivateDataset(Application application, Log log) { const string prefix = "Dataset activation"; var result = new TestResult(); var assert = new Assert(result, log); try { // Start new project via File menu var projectPage = TabProxies.GetProjectPageTabItem(application, log); if (projectPage == null) { MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log); } projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNotNull(projectPage, prefix + " - The project page was not opened."); ProjectPageControlProxies.CreateChildDatasetForRoot(application, log); ProjectPageControlProxies.CreateChildDatasetForRoot(application, log); // Wait for datasets to be created ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3); var datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log); var ids = new List<int>(datasetIds); ids.Sort(); ProjectPageControlProxies.ActivateDataset(application, log, ids[1]); var isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsTrue(isDataset1Activated, prefix + " - Failed to activate the first dataset."); var isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsFalse(isDataset2Activated, prefix + " - Activated the second dataset while it should not have been."); ProjectPageControlProxies.ActivateDataset(application, log, ids[2]); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsTrue(isDataset2Activated, prefix + " - Failed to activate the second dataset."); /* // Undo MenuProxies.UndoViaEditMenu(application, log); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsFalse(isDataset2Activated, prefix + " - Did not undo the activation state of the second dataset."); // Undo MenuProxies.UndoViaEditMenu(application, log); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsFalse(isDataset1Activated, prefix + " - Did not undo the activation state of the first dataset."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsFalse(isDataset2Activated, prefix + " - Still did not undo the activation state of the second dataset."); // Redo MenuProxies.RedoViaEditMenu(application, log); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsTrue(isDataset1Activated, prefix + " - Did not redo the undone activation state of the first dataset."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsFalse(isDataset2Activated, prefix + " - Redid the activation state of the second dataset when it should not have been."); // Redo MenuProxies.RedoViaEditMenu(application, log); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsTrue(isDataset1Activated, prefix + " - Changed the activation state of the first dataset when it should not have been."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsTrue(isDataset2Activated, prefix + " - Did not redo the undone activation state of the second dataset."); * */ ProjectPageControlProxies.DeactivateDataset(application, log, ids[1]); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsTrue(isDataset2Activated, prefix + " - Deactivated the second dataset when it should not have been."); ProjectPageControlProxies.DeactivateDataset(application, log, ids[2]); isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]); assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset."); isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]); assert.IsFalse(isDataset2Activated, prefix + " - Failed to deactivate the second dataset."); } catch (RegressionTestFailedException e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }
public async Task Delete_GET_returns_NotFound_when_provided_id_does_not_exist() { var notFoundResult = await controller.Delete(33) as NotFoundResult; Assert.IsNotNull(notFoundResult); }
public void SPNameG_AppRole_Test() { var cAction = new ActionGet<AppRole>(new ActionAppRole(_dataSource)); var sp = cAction.GetSPName("Read"); Assert.IsNotNull(sp); }
public void Create_GET_displays_the_create_form() { var viewResult = controller.Create() as ViewResult; Assert.IsNotNull(viewResult); }
private void AssertGotCustomerByExpand(EntityManager entityManager, IEnumerable<Order> orders) { var firstOrder = orders.FirstOrDefault(); Assert.IsNotNull(firstOrder, "There should be at least one order returned"); Assert.IsNotNull(firstOrder.Customer, "Related customer should be returned"); }
public async Task Edit_GET_returns_BadRequest_when_null_id() { var badRequestResult = await controller.Edit(null) as BadRequestResult; Assert.IsNotNull(badRequestResult); }
public void PalSupportsHmacSha1() { var hmac = CryptoPal.Platform.HmacSha1(); Assert.IsNotNull(hmac); }
/// <summary> /// Verifies that the 'File' menu works as expected. /// </summary> /// <param name="application">The application.</param> /// <param name="log">The log object.</param> /// <returns>The test result for the current test case.</returns> public TestResult VerifyFileMenu(Application application, Log log) { const string prefix = "File menu"; var result = new TestResult(); var assert = new Assert(result, log); try { var projectPage = TabProxies.GetProjectPageTabItem(application, log); if (projectPage != null) { TabProxies.CloseProjectPageTab(application, log); } projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNull(projectPage, prefix + " - The project page was not closed."); MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log); projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNotNull(projectPage, prefix + " - A new project was not created."); var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log); assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled"); MenuProxies.CloseProjectViaFileCloseMenuItem(application, log); projectPage = TabProxies.GetProjectPageTabItem(application, log); assert.IsNull(projectPage, prefix + " - The project page was not closed."); } catch (RegressionTestFailedException e) { var message = string.Format( CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e); log.Error(prefix, message); result.AddError(prefix + " - " + message); } return result; }