We have quite a bit of logic in TSQL stored procedures. Being a big fan of automated tests, I started writing automated tests for stored procedures.
I test stored procedures by calling them from a C# project. I make all tests touching the database inherit from a base class the ensures the test is run in a TransactionScope that is neve...
Hi,
I am implementing an application that involves some svn functions.
I'm gonna write some unit tests for the app, however, how would you suggest I write unit tests for svn commands such as checkout, update, status, etc?
Thanks!
...
In .NET 4, loading .NET 2 mixed-mode assemblies requires setting useLegacyV2RuntimeActivationPolicy="true" in the startup element of the app.config file for the application project.
How can I set this (and is it necessary) for a test project? I am getting some very odd behavior in the testing host, but only for tests that use CLR 2 mix...
I have a class which for now should always have a certain member populated before it is valid. To enforce this, the class has no default constructor and instead has a constructor which accepts a value for that required member. The setup is similar to this below:
public class MyClass
{
public string Owner { get; protected set; }
pub...
I would like to be able to unit test that an HTML.ActionLink or Url.Action will return the correct url based on my route. What is the best way to achieve this.
...
One of the primary benefits of unit testing is to provide confidence that when one needs to later alter the code one is not breaking it. However, what benefits does unit testing provide for code that is literally used as one-off throwaway code? This throwaway code is most certainly used in production, but is never actually altered once i...
When using the MVVM pattern to structure your WPF application you should get all your business logic out of the View and code-behind files. Doing it properly the View itself will be a simple facade with Data Bindings and Command Bindings to the ViewModel classes - which is where the magic happens.
One key benefit from structuring your a...
I have this problem, which may be a bug in Rhino Mocks 3.5:
stubObj = MockRepository.GenerateStub(IObject);
stubObj.Stub(a=>a.Get()).Return (Guid.Empty); //1.stub
stubObj.Stub(a=>a.Get()).Return (Guid.NewGuid()); //2.stub, should overwrite the first one?
this:
var value = stubObj.Get();
returns Guid.Empty, is this the correct beh...
I'm having a problem when a project is committed to SVN, which in turn is automatically picked up by our newly set-up CruiseControl.NET server, the UnitTests are failing.
The unit tests are written in the default Visual Studio Unit test framework - which is the problem. I spot that nUnit appears to be recommended as a good alternative. ...
Hello all,
I'm facing a problem where in I build a shared library and and a unit-test executable (which is in a sub directory)
I want to execute this test as a POST_BUILD operation for the shared library. So I gave
Add_Custom_Command (TARGET ShLibName POST_BUILD COMMAND unit_test_exe)
CMake throws an error message during generation pr...
I have a preexisting Interface...
public interface ISomeInterface
{
void SomeMethod();
}
and I've extended this intreface using a mixin...
public static class SomeInterfaceExtensions
{
public static void AnotherMethod(this ISomeInterface someInterface)
{
// Implementation here
}
}
I have a class thats callin...
I am using Moq for unit testing and I would like to test for a view's attribute.
In this case the Authorize attribute.
Example View Code:
[Authorize(Roles = "UserAdmin")]
public virtual ActionResult AddUser()
{
// view logic here
return View();
}
So I would like to test the view attribute when I act on this view with a user t...
I am still grokking attached behaviors in general, and am at a loss to see how to write a unit test for one.
I pasted some code below from Sacha Barber's Cinch framework that allows a window to be closed via attached behavior. Can somewone show me an example unit test for it?
Thanks!
Berryl
#region Close
/// <summary>Dependen...
I am trying to use test-driven development for an application that has to read a lot of data from disk. The problem is that the data is organized on the filesystem in a somewhat complex directory structure (not my fault). The methods I'm testing will need to see that a large number of files exist in several different directories in order...
Has anyone used Robotium or Calculon for testing Android apps? Are they useful? Any recommendations on which is better?
...
I'm a big believer in testing, but not a very good practitioner. I've done pretty well at getting coverage on my model objects and programming them in a TDD style. I'm actually enjoying it so much I'd love to extend this to my controller layer, particularly my UIViewController subclasses.
Unfortunately, many UIKit classes don't function...
I recently read that making a class singleton makes it impossible to mock the objects of the class, which makes it difficult to test its clients. I could not immediately understand the underlying reason. Can someone please explain what makes it impossible to mock a singleton class? Also, are there any more problems associated with making...
I am trying to set up the CUTE unit testing plugin for Eclipse C/C++ Development Tools.
The documentation says:
If you did not install Boost in the standard location, you will need to specify it. Right click on the newly created CUTE project, and select Properties. In C/C++ Build, Settings, choose the Tool Settings tab. Specify the ...
In a Visual Studio 2010 SharePoint (2010) project, we can add mapped SharePoint folders, including the {SharePointRoot} folder. When I deploy my project, I can see that the root files end up in the 14-hive, but they never appear in the web site root.
What I really want to accomplish to unit test my Silverlight application which communic...
I reading/learning "agile develpment.." now i'm on Chapter 14 (testing)/
when i tried to run
"@ruby -I test test/unit/product_test.rb"
i have error that
1) Error:
test_invalid_with_empty_attributes(ProductTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "carts" does not exist
LINE 1: DELETE FROM "carts"
...