Search Results

Search found 2240 results on 90 pages for 'assert redirected to'.

Page 19/90 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • How to check if a generic type definition inherits from another generic type definition

    - by Anne
    I'm trying to check whether an open generic type definition implements some open generic interface. Look at the sample below: public interface IService<T> { } public class ServiceImpl<T> : IService<T> { } private static bool OpenGenericTypeImplementsOpenGenericInterface( Type derivedType, Type interfaceType) { return derivedType.GetInterfaces().Contains(interfaceType); } [TestMethod] public void Verify() { Type openGenericImplementation = typeof(ServiceImpl<>); Type expectedInterfaceType = typeof(IService<>); bool implDoesImplementInterface = OpenGenericTypeImplementsOpenGenericInterface( openGenericImplementation, expectedInterfaceType); // This assert fails. Why? Assert.IsTrue(implDoesImplementInterface); } I found out that the returned type from the Type.GetInterfaces() method does not match the type returned from typeof(IService<>). I can't figure out why that is and how to correctly validate whether some generic type definition inherits or implements some other generic type definition. What's going on here and how do I solve fix this problem?

    Read the article

  • How to make the selected testcript is run in selenium grid

    - by Yui
    Hi, I can launch some remote control by using: ant launch-remote-control but I dont know how my script connect to hub? I set up ant, selenium-grid on the same computer. I have an grid.dll which is written by C# and run through NUnit. The test data is read from xml file (ValidData.xml) The example code is below : using System.Collections.Generic; using System.Linq; using System.Text; using System; using System.Xml; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using Selenium; namespace Grid { public class Class1 { //User defined private string strURL = "http://gmail.com/"; private string[] strBrowser = new string[3] { "*iehta", "*firefox", "*safari" }; string hubAddress = "192.168.20.131"; // IP of my computer // System defined private ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium(hubAddress, 4444, this.strBrowser[1], this.strURL);// do i need to identify browser when I defined it when launching a remote control selenium.Start(); verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } private string[] name; [Test] public void LoginPassedTest() { try { XmlDocument doc = new XmlDocument(); XmlNode docNode; doc.Load("ValidData.xml"); docNode = doc["TestCase"]; foreach (XmlNode node in docNode) { selenium.Open("/"); selenium.WaitForPageToLoad("50000"); selenium.Type("Email", node["username"].InnerText); selenium.Type("Passwd", node["password"].InnerText); selenium.Click("signIn"); selenium.WaitForPageToLoad("100000"); name = (selenium.GetText("//div[@id='guser']/nobr/b").Split('@')); try { Assert.AreEqual(node["username"].InnerText, name[0]); Assert.AreEqual("Sign out", selenium.GetText(":r6")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } selenium.Click(":r6"); } } catch (AssertionException e) { verificationErrors.Append(e.Message); } } } } Step I run this script: 1.I build that script into DLL 2.I start hub by using command "ant lauch-hub" 3.I start 2 remote controls by using command : ant -Dport=5566 -Denvironment="*chrome" launch-remote-control ant -Dport=5577 -Denvironment="*iexplore" launch-remote-control 4.Then I open Nunit and load DLL (code above) and run 5.The NUNit doesnot respond anything. I think there are some missing things but I dont know. How can the test script (DLL) know which is sequence of remote control is selected to run the test???? Please help me!! Thank you so much Yui.

    Read the article

  • How Moles Isolation framework is implemented?

    - by Buu Nguyen
    Moles is an isolation framework created by Microsoft. A cool feature of Moles is that it can "mock" static/non-virtual methods and sealed classes (which is not possible with frameworks like Moq). Below is the quick demonstration of what Moles can do: Assert.AreNotEqual(new DateTime(2012, 1, 1), DateTime.Now); // MDateTime is part of Moles; the below will "override" DateTime.Now's behavior MDateTime.NowGet = () => new DateTime(2012, 1, 1); Assert.AreEqual(new DateTime(2012, 1, 1), DateTime.Now); Seems like Moles is able to modify the CIL body of things like DateTime.Now at runtime. Since Moles isn't open-source, I'm curious to know which mechanism Moles uses in order to modify methods' CIL at runtime. Can anyone shed any light?

    Read the article

  • Generic List<T> as IEnumerable<object>

    - by Avi
    I'm trying to do cast a List to an IEnumerable, so I can verify that different lists are not null or empty: Suppose myList is a List < T . Then in the caller code I wanted: Validator.VerifyNotNullOrEmpty(myList as IEnumerable<object>, @"myList", @"ClassName.MethodName"); The valdiating code would be: public static void VerifyNotNullOrEmpty(IEnumerable<object> theIEnumerable, string theIEnumerableName, string theVerifyingPosition) { string errMsg = theVerifyingPosition + " " + theIEnumerableName; if (theIEnumerable == null) { errMsg += @" is null"; Debug.Assert(false); throw new ApplicationException(errMsg); } else if (theIEnumerable.Count() == 0) { errMsg += @" is empty"; Debug.Assert(false); throw new ApplicationException(errMsg); } } However, this doens't work. It compiles, but theIEnumerable is null! Why?

    Read the article

  • Google search result redirecting to tinyurl4.info

    - by GaVrA
    When you google for these keywords: crtaci.info First result is my site, www.crtaci.info. Now, i have no idea what is happening, but when you click on that search result sometimes it redirects you to tinyurl4.info: I know in this image user is using IE, but both me on win7 and firefox and IE8 and my buddy on linux(and some browsers i have never heard of) both tested this and we got redirected to this site. But only once. Now when i do that again, it opens up my site. What the hell is going on? Please advise what to do! :( Maybe i should open this on serverfoult, i dont know... :( UPDATE: This only seems to be happening when you do this for the first time in your browser. Next time you do it it is ok. I have opened up chrome, which i only use for testing and did these steps: open google.com search for crtaci.info click on first result i get redirected open google.com again search for crtaci.info again it works fine now

    Read the article

  • "Debug Assertion" Runtime Error on VS2008?

    - by Linda Cohen
    I' writing a C++ MFC program on VS2008 and I'm getting this "Debug Assertion Error" when I first run the program sometimes. When I try to debug it, it takes me to this winhand.cpp file which is not part of the program I wrote so I'm not sure how to debug this. It takes the error to this place in winhand.cpp CObject* pTemp = LookupTemporary(h); if (pTemp != NULL) { // temporary objects must have correct handle values HANDLE* ph = (HANDLE*)((BYTE*)pTemp + m_nOffset); // after CObject ASSERT(ph[0] == h || ph[0] == NULL); if (m_nHandles == 2) ASSERT(ph[1] == h); } So why does this error happen? Why does it only happen sometimes (50% of the time)? How would I debug this? I'll provide some code if is needed. THANKS!

    Read the article

  • fb:request-form in iframe redirects away from facebook

    - by IkimashoZ
    I have an <fb:requestform> in an iFrame Facebook app. I have set target="_parent", so that the callback will target the parent iFrame and not itself, which seems to work as expected. But, instead of my desired file loading, I get redirected to my server. Checking the response of the requestform's POST in Firebug revealed this: <script type="text/javascript"> top.location.href = "http://www.facebook.com/login.php?api_key=***&v=1.0&req_perms=&next=http%3A%2F%2F***"; </script> I have already had this same problem when sending jQuery AJAX requests to update various elements in an iFrame. I solved the problem by making sure my headers contain P3P: CP="CAO PSA OUR". That is indeed set for this call as well (can be seen clearly in Firebug), but I still get redirected to facebook.com/login.php.

    Read the article

  • routing problem in codeigniter

    - by Obay
    I'm new to CodeIgniter and routing. I have a Login controller whose index() loads up a view to enter a username/password. In the view, the form has action="login/authenticate". Login-authenticate() determines if the login is valid or not. If it's valid, redirect('lobby'), if not redirect('login') routes.php: $route['default_controller'] = "login" config.php: $config['base_url'] = "http://localhost/dts/"; $config['index_page'] = "index.php"; The problem is that when i go to http://localhost/dts/ , click login, I am correctly (?) redirected to http://localhost/dts/login/authenticate but the browser says Object not found!. But when I go to http://localhost/dts/index.php/ (with trailing slash), it works correctly (I get redirected to http://localhost/dts/index.php/login/authenticate, and am logged in) I tried removing "index.php" by using a .htaccess: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] and it would no longer open even the http://localhost/dts/ I'm confused.. what's going on?

    Read the article

  • Good error flagging

    - by Wayne
    For everyone that was thinking of the error_reporting() function, then it isn't, what I need is whenever a MySQL query has been done, and the statement has like if($result) { echo "Yes, it was fine... bla bla"; } else { echo "Obviously, the echo'ing will show in a white page with the text ONLY..."; } Whenever statements have been true or false, I want the error to be appeared when redirected with the header() function and echo the error reporting in a div somewhere on the page. Basically something like this: $error = ''; This part appears inside the div tags <div><?php echo $error; ?></div> So the error part will be echoed when redirected with the header() if($result) { $error = "Yes, it was fine... bla bla"; header("Location: url"); } else { $error = "Something wrong happened..."; header("Location: url"); } But that just doesn't work :(

    Read the article

  • Erlang: How to view output of io:format/2 calls in processes spawned on remote nodes.

    - by jkndrkn
    Hello, I am working on a decentralized Erlang application. I am currently working on a single PC and creating multiple nodes by initializing erl with the -sname flag. When I spawn a process using spawn/4 on its home node, I can see output generated by calls io:format/2 within that process in its home erl instance. When I spawn a process remotely by using spawn/4 in combination with register_name, output of io:format/2 is sometimes redirected back to the erl instance where the remote spawn/4 call was made, and sometimes remains completely invisible. Similarly, when I use rpc:call/4, output of io:format/2 calls is redirected back to the erl instance where the `rpc:call/4' call is made. How do you get a process to emit debugging output back to its parent erl instance?

    Read the article

  • dynamically created datagridview columns not accessible unless added to a form...why?

    - by deostroll
    We simply created a DataGridView control dynamically and bound it to a DataTable. We were tying to style certain columns. But, when we tried to access the columns we got a null reference. On further investigation we found that if we add the DataGridView control to the main form, and then try to access its columns, it works fine!!! Code which throws error: DataGridView gv = new DataGridView(); gv.DataSource = GetDataTable(); //binding it to datatable Debug.Assert(gv.Columns == null); Code which works fine: DataGridView gv = new DataGridView(); gv.DataSource = GetDataTable(); //binding it to datatable this.Controls.Add(gv); //adding to form Debug.Assert(gv.Columns == null); //the assertion fails! Why is this behaviour so? Is there a workaround for this?

    Read the article

  • PHP mySQL database check

    - by kielie
    Hi guys, I am having endless troubles with duplicate entries, so I need to check the database, and if a user has already entered that day, their entry will not be submitted and they will be redirected to a landing page that tells them they have already entered that day, and that they may only enter again tomorrow. The field I would like to check is the id_number field in the database, since each user has a unique id number, so basically, if a user with the same id number submitted on the same date they should be redirected to a landing page, how would I go about doing this? I am still new to a lot of this, so please be forgiving. Thanx in advance.

    Read the article

  • Apache rewrite with many slash not working?

    - by Daok
    I have modified a website with a redirection to a single page: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] It works as it suppose to be. Everything is redirected to index.php. Here is a working example that display index.php with all images and css: http://.....com/section1 The problem occur when I try : http://....com/section1/subsection The page is redirected to index.php, BUT no images, no css, no javascript. Inside the PHP script everything is like this directly linked to the images or css or javascript like: <img src="images/images1.png> ... <img src="images2.png"> Why does url with many slash like .com../123/123/whatever does not work with images, css or javascript when .com/no_slash_url works?

    Read the article

  • Showing the ProgressDialog while opening the Website

    - by david
    I have to open a website say Facebook page, twitter page and You Tube page in order to share my post there. Now when I click to the item Facebook , it gets redirected to FB to share and same for Twitter and YouTube. I have to show them in my WebView and all this is done perfectly. What I want is to show the Progress Dialog after clicking on the Item till it gets redirected to the FB , Twitter or YouTube. I don know how to show the Progress Bar for redirecting to the Main Website. Can anyone Please help me put Here. Thanks, David Brown

    Read the article

  • NUnit / Testdriven.Net conflicting results.

    - by panamack
    When I run this test in NUnit = Red Bar. [Test] public void ChangingValueViaPropertyDescriptorRaisesPropertyChangedNotification() { PropertyChangedEventArgs pCEventArgs = null; subjectVM.PropertyChanged += (sender, e) => { pCEventArgs = e; }; PropertyDescriptor descriptor = subjectVM.GetProperties().Find(schoolMeta.Name, false); descriptor.SetValue(null, "School's out for summer."); Assert.IsNotNull(pCEventArgs); Assert.AreEqual("School", pCEventArgs.PropertyName); } However, when I run this test from within Visual Studio with Test Driven .Net it passes. When it fails with NUnit it's because PropertyChanged is null, subjectVM is a View Model classes that inherits PropertyChanged from a base class. Am I to blame, or am I looking at a NUnit bug?

    Read the article

  • asp.net: Is it possible to have multiple login forms to access different subfolders?

    - by Anthony
    Hi, Is it possible to have multiple login pages for different folders within an asp.net application? Say I have this structure: /admin /customer /login-admin.aspx /login-customer.aspx I have 2 different login forms. One for the admin people and one for the customers (the forms are different as the customers need to provide extra information on their login page). In the authentication section of the webconfig file (which is at the root of the web app), I can only specify one Login page. So how can I make sure thaf if anyone tries to access a webpage in /admin they will be redirected to /login-admin.aspx and if they try to access a webpage in /customer they will be redirected to /login-customer.aspx ? Thanks, Anthony

    Read the article

  • Can access maven repository from behind proxy, need help.

    - by Digambar Daund
    I am trying to access maven repository from behind proxy. I configured settings.xml correctly (i guess so...) true http username password 12.34.56.78 8080 But still I am error message like... if i dont configure userid/password gets correct error message which is HTTP response code 407 - saying authentication required. But If I configure correct/incorrect proxy authentication it always prints below error message.... Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error trans ferring file: Server redirected too many times (20) Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error trans ferring file: Server redirected too many times (20) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR

    Read the article

  • REST API unauthenticated requests exception based on the User-Agent

    - by Shay Tsadok
    Hi All, I am developing a REST API that supports two kinds of authentication protocols: login form authentication - for browser based clients. Simple Basic authentication - for non-browser clients. I developed a flow in which unauthenticated requests redirected to the "login form", the problem is that this is an undesired behavior for non-borwser clients! I thought to solve it by decide according to the "User-Agent" what to do: browsers will be redirected to the "login form" and non-browser clients will get the standard 401:Basic Authentication. A. What do you think about this solution? B. Is there a standard way in Java to check if the request came from browser, or do i need to develop this kind of mechanism by my own? Thanks in advance!

    Read the article

  • Is AutoMapper able to auto resolve types base on existing maps

    - by Chi Chan
    I have the following code: [SetUp] public void SetMeUp() { Mapper.CreateMap<SourceObject, DestinationObject>(); } [Test] public void Testing() { var source = new SourceObject {Id = 123}; var destination1 = Mapper.Map<SourceObject, DestinationObject>(source); var destination2 = Mapper.Map<ObjectBase, ObjectBase>(source); //Works Assert.That(destination1.Id == source.Id); //Fails, gives the same object back Assert.That(destination2 is DestinationObject); } public class ObjectBase { public int Id { get; set; } } public class SourceObject : ObjectBase { } public class DestinationObject : ObjectBase { } So basically, I want AutoMapper to automatically resolve the destination type to "DestinationObject" based on the existing Maps set up in AutoMapper. Is there a way to achieve this?

    Read the article

  • Fleunt NHibernate not working outside of nunit test fixtures

    - by thorkia
    Okay, here is my problem... I created a Data Layer using the RTM Fluent Nhibernate. My create session code looks like this: _session = Fluently.Configure(). Database(SQLiteConfiguration.Standard.UsingFile("Data.s3db")) .Mappings( m => { m.FluentMappings.AddFromAssemblyOf<ProductMap>(); m.FluentMappings.AddFromAssemblyOf<ProductLogMap>(); }) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); When I reference the module in a test project, then create a test fixture that looks something like this: [Test] public void CanAddProduct() { var product = new Product {Code = "9", Name = "Test 9"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); using (ISession session = OrmHelper.OpenSession()) { var fromDb = session.Get<Product>(product.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(fromDb, product); Assert.AreEqual(fromDb.Id, product.Id); } My tests pass. When I open up the created SQLite DB, the new Product with Code 9 is in it. the tables for Product and ProductLog are there. Now, when I create a new console application, and reference the same library, do something like this: Product product = new Product() {Code = "10", Name = "Hello"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); Console.WriteLine(product.Id); Console.ReadLine(); It doesn't work. I actually get pretty nasty exception chain. To save you lots of head aches, here is the summary: Top Level exception: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.\r\n\r\n The PotentialReasons collection is empty The Inner exception: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. Both the unit test library and the console application reference the exact same version of System.Data.SQLite. Both projects have the exact same DLLs in the debug folder. I even tried copying SQLite DB the unit test library created into the debug directory of the console app, and removed the build schema lines and it still fails If anyone can help me figure out why this won't work outside of my unit tests it would be greatly appreciated. This crazy bug has me at a stand still.

    Read the article

  • Can I configure NUnit so that Debug.Fail doesn't show a message box when I run my tests?

    - by panamack
    I have this property: public SubjectStatus Status { get { return status; } set { if (Enum.IsDefined(typeof(SubjectStatus), value)) { status = value; } else { Debug.Fail("Error setting Subject.Status", "There is no SubjectStatus enum constant defined for that value."); return; } } } and this unit test [Test] public void StatusProperty_StatusChangedToValueWithoutEnumDefinition_StatusUnchanged() { Subject subject = new TestSubjectImp("1"); // assigned by casting from an int to a defined value subject.Status = (SubjectStatus)2; Assert.AreEqual(SubjectStatus.Completed, subject.Status); // assigned by casting from an int to an undefined value subject.Status = (SubjectStatus)100; // no change to previous value Assert.AreEqual(SubjectStatus.Completed, subject.Status); } Is there a way I can prevent Debug.Fail displaying a message box when I run my tests, but allow it to show me one when I debug my application?

    Read the article

  • Linq to NHibernate using Queryable.Where predicate

    - by Groo
    I am querying an SQLite database using LINQ to NHibernate. Person is an entity containing an Id and a Name: public class Person { public Guid Id { get; private set; } public string Name { get; private set; } } Let's say my db table contains a single person whose name is "John". This test works as expected: var query = from item in session.Linq<Person>() where (item.Name == "Mike") select item; // no such entity should exist Assert.IsFalse(query.Any()); but this one fails: var query = from item in session.Linq<Person>() select item; query.Where(item => item.Name == "Mike"); // following line actually returns the // "John" entry Assert.IsFalse(query.Any()); What am I missing?

    Read the article

  • Steps to integrate Paypal payments pro without SSL

    - by Nicolas
    Hi, We are looking to integrate Paypal payments in order to "spotlight" (or feature) ads and people on our website, but we do not want to use SSL. Here's the process I would like to set up: User click on "I want my ad/profile to be spotlighted" Description page of what he's going to pay Click on payment button Redirected to paypal (can we customise the page layout?) Paypal process, during which paypal notifies us when the payment's done and ok Once done, user's redirected to a page on our website (PHP) We already own a Paypal payment pro account Any help on how to do all these steps is appreciated, although steps 1,2,3 and 6 is likely to be up to me to setup. Cheers, Nicolas.

    Read the article

  • Find subset with K elements that are closest to eachother

    - by Nima
    Given an array of integers size N, how can you efficiently find a subset of size K with elements that are closest to each other? Let the closeness for a subset (x1,x2,x3,..xk) be defined as: 2 <= N <= 10^5 2 <= K <= N constraints: Array may contain duplicates and is not guaranteed to be sorted. My brute force solution is very slow for large N, and it doesn't check if there's more than 1 solution: N = input() K = input() assert 2 <= N <= 10**5 assert 2 <= K <= N a = [] for i in xrange(0, N): a.append(input()) a.sort() minimum = sys.maxint startindex = 0 for i in xrange(0,N-K+1): last = i + K tmp = 0 for j in xrange(i, last): for l in xrange(j+1, last): tmp += abs(a[j]-a[l]) if(tmp > minimum): break if(tmp < minimum): minimum = tmp startindex = i #end index = startindex + K? Examples: N = 7 K = 3 array = [10,100,300,200,1000,20,30] result = [10,20,30] N = 10 K = 4 array = [1,2,3,4,10,20,30,40,100,200] result = [1,2,3,4]

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >