Search Results

Search found 5783 results on 232 pages for 'translation unit'.

Page 42/232 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Unit test project doesn't recognize the classes it was generated from

    - by DougLeary
    I have a fairly simple file-system website consisting of one aspx page and several classes in separate .cs files. Everything is on my own HD. The web app itself builds and runs fine. Out of curiosity I decided to try out Visual Studio's nifty, easy-to-use unit test feature. So I opened each class file and clicked Create Unit Tests. VS generated a test project containing a set of test classes and some other files. Easy! But when I try to build or run the test project it throws a series of build errors, one for every class: The type or namespace name 'class-name' could not be found (are you missing a using directive or an assembly reference?). Somebody asked if my test project has a reference to the original project. Well no, because the original project is a file-system website. It has no bin folder and no DLL, so there's nothing to reference as far as I can tell. I would think that since VS generated these unit tests it would generate whatever references it needs, but apparently not. Is generating unit tests for file-system web apps an undocumented no-no, or is there a magic trick to getting it to work?

    Read the article

  • Terminology: Difference between software interface, software component, software unit, software modu

    - by JamieH
    I see these terms used quite a lot between various authors, but I can't seem to fix upon definitive definitions. From my POV a software interface is a "type" specifying the way in which a software component may be used by other softare components. But what exactly a software component is I'm not entirely sure (and it seems no-one else is either). Same goes for software unit, and software module, although I suspect that a software unit is a smaller, ahem, unit than a component, and a software module has something to do with packaging. I hope this is not deemed (and downvoted) as frivulous, as I have serious intent in the asking.

    Read the article

  • Creating a Compilation Unit with type bindings

    - by hizki
    I am working with the AST API in java, and I am trying to create a Compilation Unit with type bindings. I wrote the following code: private static CompilationUnit parse(ICompilationUnit unit) { ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setKind(ASTParser.K_COMPILATION_UNIT); parser.setSource(unit); parser.setResolveBindings(true); CompilationUnit compiUnit = (CompilationUnit) parser.createAST(null); return compiUnit; } Unfortunately, when I run this code in debug mode and inspect compiUnit I find that compiUnit.resolver.isRecoveringBindings is false. Can anyone think of a reason why it wouldn't be true, as I specified it to be? Thank you

    Read the article

  • Validate cyclic organization unit

    - by abmv
    I have a object Organization Unit and I have a self reference to it in the same object public class OrganizationUnit: IOrganizationUnit { private string fName; public string Name { get { return fName; } set { SetPropertyValue("Name", ref fName, (string) value); } } private OrganizationUnit fManagedBy; public IOrganizationUnit ManagedBy { get { return fManagedBy; } set { SetPropertyValue("ManagedBy", ref fManagedBy, (OrganizationUnit)value); } } } I need a method that will throw an exception if it finds a child organization unit in the third level is referencing a parent Organization unit, or to say cyclic parent organization. A is main B managed by A C

    Read the article

  • Unit Test ouput in MSBuild/TFS 2008

    - by Adam Jenkin
    I have a build in TFS 2008 which includes the running of a UnitTest project. I have configured my build as such that in the drop folder after each build, I get a StyleCop.log, FxCop.log and would like to place the trx or output from the unit tests here also. I can see that my unit tests are running as part of the build, however currently I cannot find were the output is saved to or find a way of setting the ouput to my drop location ($(DropLocation)\$(BuildNumber)\MyUnitTests.txt) My unit tests are included by using the following:- <RunTest>true</RunTest> ... <ItemGroup> <TestContainer Include="$(OutDir)\%2aMyUnitTests.dll" /> </ItemGroup> Can somebody help explain how I can achieve this.

    Read the article

  • Should tests be self written in TDD?

    - by martin
    We run a project, which we want to solve with test driven development. I thought about some questions that came up, when initiating the project. One question was, who should write the unit-test for a feature. Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer, who defines what a method should do and the feature-implementing programmer implements the method until the tests runs? If i understand the concept of TDD in the right way. The feature-implementing programmer has to write the test by himself, because TDD is procedure with mini-iterations. So it would be too complex to have the tests written by another programmer? What would you say, should the tests in TDD written by the programmer himself or should another programmer write the tests that describes what a method can do?

    Read the article

  • Should methods containing LINQ expressions be tested / mocked?

    - by Phil.Wheeler
    Assuming I have a class with a method that takes a System.Linq.Expressions.Expression as a parameter, how much value is there in unit testing it? public void IEnumerable<T> Find(Expression expression) { return someCollection.Where(expression).ToList(); } Unit testing or mocking these sorts of methods has been a mind-frying experience for me and I'm now at the point where I have to wonder whether it's all just not worth it. How would I unit test this method using some arbitrary expression like List<Animal> = myAnimalRepository.Find(x => x.Species == "Cat");

    Read the article

  • Problem using System.Xml in unit test in MonoDevelop (MonoTouch)

    - by hambonious
    I'm new to the MonoDevelop and MonoTouch environment so hopefully I'm just missing something easy here. When I have a unit test that requires the System.Xml or System.Xml.Linq namespaces, I get the following error when I run the test: System.IO.FileNotFoundException : Could not load file or assembly 'System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Things I've verified: I have the proper usings in the test. The project builds with no problems. Using these namespaces work fine when I run the app in the emulator. I've written a very simple unit test to prove that unit testing works at all (and it does). I'm a test driven kinda guy so I can't wait to get this working so I can progress with my app. Thanks in advance.

    Read the article

  • Get list of named queries in NHibernate

    - by Dan
    I have a dozen or so named queries in my NHibernate project and I want to execute them against a test database in unit tests to make sure the syntax still matches the changing domain/database model. Currently I have a unit test for each named query where I get and execute the query, for example: IQuery query = session.GetNamedQuery("GetPersonSummaries"); var personSummaryArray = query.List(); Assert.That(personSummaryArray, Is.Not.Null); This works fine, but I would like to have one unit test that loops thru all of the named queries and executes them. Is there a way to discover all of the available named queries? Thanks Dan

    Read the article

  • How to simulate a mouse click in Cocoa for the iPhone?

    - by eagle
    I'm trying to setup automated unit tests for an iPhone application. I'm using a UIWebBrowser and need to simulate clicks on different links. I've tried doing this with JavaScript, but it doesn't produce the same results as when the I manually click on the links. The main problem is with links that have their target property set. I believe the only way for this automated unit test to work correctly is to simulate a mouse click at a specific x/y coordinate (i.e. where the link is located). Since the unit testing will only be used internally, private API calls are fine. It seems like this should be possible since the iPhone app isimulate seems to do something similar. Is there any way to do this in the framework?

    Read the article

  • Mongomapper - unit testing with shoulda on rails 2.3.5

    - by egarcia
    I'm trying to implement shoulda unit tests on a rails 2.3.5 app using mongomapper. So far I've: Configured a rails app that uses mongomapper (the app works) Added shoulda to my gems, and installed it with rake gems:install Added config.frameworks -= [ :active_record, :active_resource ] to config/environment.rb so ActiveRecord isn't used. My models look like this: class Account include MongoMapper::Document key :name, String, :required => true key :description, String key :company_id, ObjectId key :_type, String belongs_to :company many :operations end My test for that model is this one: class AccountTest < Test::Unit::TestCase should_belong_to :company should_have_many :operations should_validate_presence_of :name end It fails on the first should_belong_to: ./test/unit/account_test.rb:3: undefined method `should_belong_to' for AccountTest:Class (NoMethodError) Any ideas why this doesn't work? Should I try something different from shoulda? I must point out that this is the first time I try to use shoulda, and I'm pretty new to testing itself.

    Read the article

  • Persistence unit is not persistent

    - by etam
    I need persistence unit that creates embedded database which stays persistent after closing EntityManager. This is my PU: <persistence-unit name="hello-jpa" transaction-type="RESOURCE_LOCAL"> <class>hello.jpa.User</class> <properties> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/> <property name="hibernate.connection.username" value="sa"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:hsqldb:target/hsql.db"/> <property name="hibernate.hbm2ddl.auto" value="update"/> </properties> </persistence-unit> And it deletes data after closing application.

    Read the article

  • Cannot run unit tests for an application developed with Compact Framework for Windows CE 6.0 platfor

    - by Thomasek
    I'm developing a solution for Windows CE 6.0 using GuD_AtomKit X86 Device emulator. I'm not able to run any unit tests, because I get following error message: The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Exception of type 'Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.TestAlreadyRunningException' was thrown. But there's no unit test running on the device. I would really appreciate your help.

    Read the article

  • Matlab - Propagate unit vectors on to the edge of shape boundaries

    - by Graham
    Hi I have a set of unit vectors which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used? Or would it be a case of taking the unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection? Thank you very much in advance for any help!

    Read the article

  • In TDD, should tests be written by the person who implemented the feature under test?

    - by martin
    We run a project in which we want to solve with test driven development. I thought about some questions that came up when initiating the project. One question was: Who should write the unit-test for a feature? Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer, who defines what a method should do and the feature-implementing programmer implements the method until the tests runs? If I understand the concept of TDD in the right way, the feature-implementing programmer has to write the test by himself, because TDD is procedure with mini-iterations. So it would be too complex to have the tests written by another programmer? What would you say? Should the tests in TDD be written by the programmer himself or should another programmer write the tests that describes what a method can do?

    Read the article

  • Private Accessor for method is not found

    - by Farinha
    I'm getting this error when generating a new unit test under Visual Studio 2010 using the context menu (right-click the method name - "Generate Unit Tests"): Private Accessor for methodName is not found. Please rebuild the containing project or run the Publicize.exe manually. The method is public (checked that by applying applying a filter to not show non-public methods in the "Generate Unit Tests" dialog. Visual Studio creates some kind of .accessor file automatically. Do I need to do anything in it? What else could be the problem?

    Read the article

  • Tests that are 2-3 times bigger than the testable code

    - by HeavyWave
    Is it normal to have tests that are way bigger than the actual code being tested? For every line of code I am testing I usually have 2-3 lines in the unit test. Which ultimately leads to tons of time being spent just typing the tests in (mock, mock and mock more). Where are the time savings? Do you ever avoid tests for code that is along the lines of being trivial? Most of my methods are less than 10 lines long and testing each one of them takes a lot of time, to the point where, as you see, I start questioning writing most of the tests in the first place. I am not advocating not unit testing, I like it. Just want to see what factors people consider before writing tests. They come at a cost (in terms of time, hence money), so this cost must be evaluated somehow. How do you estimate the savings created by your unit tests, if ever?

    Read the article

  • Functions without arguments, with unit as argument in scala

    - by scout
    def foo(x:Int, f:Unit=>Int) = println(f()) foo(2, {Unit => 3+4} //case1 def loop:Int = 7 foo(2, loop) //does not compile changing loop to //case 2 def loop():Int = 7 foo(2, loop) // does not compile changing loop to //case 3 def loop(x:Unit): Int = 7 //changing according to Don's Comments foo(2,loop) // compiles and works fine should'nt case 1 and case 2 also work? why are they not working? defining foo as def foo(x:Int, y:()=>Int) then case 2 works but not case 1. Arent they all supposed to work, defining the functions either way. //also i think ()=Int in foo is a bad style, y:=Int does not work, comments??

    Read the article

  • What is the unit of size we get from using wmic command on windows

    - by Abhishek Simon
    I use a couple of wmic commands and I was wondering how can a user come to know the the unit of any size related command output? For Instance I use the below 2 commands wmic /node:Abhishek-PC cpu get maxclockspeed,l2cachesize,loadpercentage output: L2CacheSize LoadPercentage MaxClockSpeed 8192 1 1595 8192 1 1595 wmic /node:Abhishek-PC LogicalDisk Where DriveType="3" Get DeviceID,Size,FreeSpace output: DeviceID FreeSpace Size C: 13933780992 73300701184 E: 23688204288 73405558784

    Read the article

  • Secure Standalone Server Plus Firewall Unit [closed]

    - by orbitron
    We need to send a 2U server, 1U UPS and 1U firewall to a third-party. The thing is, it needs to be a secured case (locked unit) that has proper airflow and we can have power and networking cables coming out of the back. We've googled far and wide and have only been able to find 'hard case' units that offer some level of security but they are extremely bulky and require freight delivery. Thank you for any insight or solutions.

    Read the article

  • Google AJAX Transliteration API :- How do i translate many elements in page to some language at one

    - by Nitesh Panchal
    Hello, I have many elements on page and all of which i want to translate to some language. The language is not the same for all fields, that is, for 1st field it may be fr and for third field it may be en then again for 7th field it may be pa. Basically i wrote the code and it's working :- <script type="text/javascript"> //<![CDATA[ google.load("language", "1"); window.onload = function(){ var elemPostTitles = document.getElementsByTagName("h4"); var flag = true; for(var i = 0 ; i < elemPostTitles.length ; i++){ while(flag == false){ } var postTitleElem = elemPostTitles[i]; var postContentElem = document.getElementById("postContent_" + i); var postTitle = postTitleElem.innerHTML; var postContent = postContentElem.innerHTML; var languageCode = document.getElementById("languageCode_" + i).value; google.language.detect(postTitle, function(result) { if (!result.error && result.language) { google.language.translate(postTitle, result.language, languageCode, function(result) { flag = true; if (result.translation) { postTitleElem.innerHTML = result.translation; } }); } }); flag = false; } As you can see, what i am trying to do is restrict the loop from traversing until the result of previous ajax call is receieved. If i don't do this only the last field gets translated. My code works nicely, but because of the infinite loop, i keep getting errors from Mozilla to "stop executing scripts". How do i get rid of this? Also, is my approach correct? Or some inbuilt function is available which can ease my task? Thanks in advance :)

    Read the article

  • Writing Unit Tests for an ASP.NET MVC Action Method that handles Ajax Request and Normal Request

    - by shiju
    In this blog post, I will demonstrate how to write unit tests for an ASP.NET MVC action method, which handles both Ajax request and normal HTTP Request. I will write a unit test for specifying the behavior of an Ajax request and will write another unit test for specifying the behavior of a normal HTTP request. Both Ajax request and normal request will be handled by a single action method. So the ASP.NET MVC action method will be execute HTTP Request object’s IsAjaxRequest method for identifying whether it is an Ajax request or not. So we have to create mock object for Request object and also have to make as a Ajax request from the unit test for verifying the behavior of an Ajax request. I have used NUnit and Moq for writing unit tests. Let me write a unit test for a Ajax request Code Snippet [Test] public void Index_AjaxRequest_Returns_Partial_With_Expense_List() {     // Arrange       Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();     Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();     Mock<HttpContextBase> context = new Mock<HttpContextBase>();       context.Setup(c => c.Request).Returns(request.Object);     context.Setup(c => c.Response).Returns(response.Object);     //Add XMLHttpRequest request header     request.Setup(req => req["X-Requested-With"]).         Returns("XMLHttpRequest");       IEnumerable<Expense> fakeExpenses = GetMockExpenses();     expenseRepository.Setup(x => x.GetMany(It.         IsAny<Expression<Func<Expense, bool>>>())).         Returns(fakeExpenses);     ExpenseController controller = new ExpenseController(         commandBus.Object, categoryRepository.Object,         expenseRepository.Object);     controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller);     // Act     var result = controller.Index(null, null) as PartialViewResult;     // Assert     Assert.AreEqual("_ExpenseList", result.ViewName);     Assert.IsNotNull(result, "View Result is null");     Assert.IsInstanceOf(typeof(IEnumerable<Expense>),             result.ViewData.Model, "Wrong View Model");     var expenses = result.ViewData.Model as IEnumerable<Expense>;     Assert.AreEqual(3, expenses.Count(),         "Got wrong number of Categories");         }   In the above unit test, we are calling Index action method of a controller named ExpenseController, which will returns a PartialView named _ExpenseList, if it is an Ajax request. We have created mock object for HTTPContextBase and setup XMLHttpRequest request header for Request object’s X-Requested-With for making it as a Ajax request. We have specified the ControllerContext property of the controller with mocked object HTTPContextBase. Code Snippet controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller); Let me write a unit test for a normal HTTP method Code Snippet [Test] public void Index_NormalRequest_Returns_Index_With_Expense_List() {     // Arrange               Mock<HttpRequestBase> request = new Mock<HttpRequestBase>();     Mock<HttpResponseBase> response = new Mock<HttpResponseBase>();     Mock<HttpContextBase> context = new Mock<HttpContextBase>();       context.Setup(c => c.Request).Returns(request.Object);     context.Setup(c => c.Response).Returns(response.Object);       IEnumerable<Expense> fakeExpenses = GetMockExpenses();       expenseRepository.Setup(x => x.GetMany(It.         IsAny<Expression<Func<Expense, bool>>>())).         Returns(fakeExpenses);     ExpenseController controller = new ExpenseController(         commandBus.Object, categoryRepository.Object,         expenseRepository.Object);     controller.ControllerContext = new ControllerContext(         context.Object, new RouteData(), controller);     // Act     var result = controller.Index(null, null) as ViewResult;     // Assert     Assert.AreEqual("Index", result.ViewName);     Assert.IsNotNull(result, "View Result is null");     Assert.IsInstanceOf(typeof(IEnumerable<Expense>),             result.ViewData.Model, "Wrong View Model");     var expenses = result.ViewData.Model         as IEnumerable<Expense>;     Assert.AreEqual(3, expenses.Count(),         "Got wrong number of Categories"); }   In the above unit test, we are not specifying the XMLHttpRequest request header for Request object’s X-Requested-With, so that it will be normal HTTP Request. If this is a normal request, the action method will return a ViewResult with a view template named Index. The below is the implementation of Index action method Code Snippet public ActionResult Index(DateTime? startDate, DateTime? endDate) {     //If date is not passed, take current month's first and last date     DateTime dtNow;     dtNow = DateTime.Today;     if (!startDate.HasValue)     {         startDate = new DateTime(dtNow.Year, dtNow.Month, 1);         endDate = startDate.Value.AddMonths(1).AddDays(-1);     }     //take last date of start date's month, if end date is not passed     if (startDate.HasValue && !endDate.HasValue)     {         endDate = (new DateTime(startDate.Value.Year,             startDate.Value.Month, 1)).AddMonths(1).AddDays(-1);     }     var expenses = expenseRepository.GetMany(         exp => exp.Date >= startDate && exp.Date <= endDate);     //if request is Ajax will return partial view     if (Request.IsAjaxRequest())     {         return PartialView("_ExpenseList", expenses);     }     //set start date and end date to ViewBag dictionary     ViewBag.StartDate = startDate.Value.ToShortDateString();     ViewBag.EndDate = endDate.Value.ToShortDateString();     //if request is not ajax     return View("Index",expenses); }   The index action method will returns a PartialView named _ExpenseList, if it is an Ajax request and will returns a View named Index if it is a normal request. Source Code The source code has been taken from my EFMVC app which can download from here

    Read the article

  • Android Eclipse Plugin: Instrumentation Test Runner not specified.

    - by Rob Stevenson-Leggett
    I'm getting this error when trying to run unit tests from Eclipse with an Android Project. The list of Instrumentation Test Runners is empty in the Android preferences. [2009-06-17 23:57:51 - MyApp] ERROR: Application does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner Google-fu failing me. It's also annoyingly decided that because I tried to run a unit test once, that's what I always want to do... Grr

    Read the article

  • Testing Visual Studio 2008 Package

    - by Dave Swersky
    I'm developing a Visual Studio Integration Package. When I try to run the Unit Tests that are included in the unit test project that is included in the template I get the following failure on the first test: The test adapter 'VsIdeHostAdapter' threw an exception while running test 'MenuItemCallback'. Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)) It's intermittent- a new instance of Visual Studio always spins up, then sometimes it works but usually fails.

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >