Hi,
I've got a set of classes I'm trying to test. Class A depends on Class X. Class X contains functions which do random things and things with databases. I've created a mock version of Class X which returns exactly what I want it to in order to test Class A without dependencies.
So, my question is, how do I now test Class X as I've a...
I have been playing around with modifiers with static method and came across a weird behaviour.
As we know, static methods cannot be overridden, as they are associated with class rather than instance.
So if I have the below snippet, it compiles fine
//Snippet 1 - Compiles fine
public class A{
static void ts(){}
}
class B extends...
What I really want is, how do I know when each stage of C++ initialization is truly DONE?
There is static initialization where simple things get assigned. Then there's dynamic static initialization where more complicated statics get assigned, which is not defined across 'translation units'. This is kind of horrible, and there are not ma...
When is it considered poor practice to use the static keyword in Java on method signatures? If a method performs a function based upon some arguments, and does not require access to fields that are not static, then wouldn't you always want these types of methods to be static?
...
If a class implements a singleton pattern, should all the variables be declared static?
Is there any reason they shouldn't be declared static? Does it make a difference?
...
My problem in brief:
class A
{
/* Other stuff in my class*/
protected static staticMember;
}
class B : A
{
/* Other stuff in my class*/
// Will have A.staticMember but I want B.staticMember (same type)
}
class C : A
{
/* Other stuff in my class*/
// Will have A.staticMember but I want C.staticMember (same type)
}
...
I am writing unit tests for a project in ASP.NET MVC 1.0 using Moq and MvcContrib TestHelper classes. I have run into a problem.
When I come to Roles.AddUserToRole in my AccountController, I get a System.NotSupportedException. The Roles class is static and Moq cannot mock a static class.
What can I do?
...
Hi,
I'm trying to write a test suit for my Qt(c++) application using google test, the main problem is that my application consists of one main program and various shared libs. Everything was working just fine, until I tried to do some code coverage using gcov/lcov (which don't operate on dynamic libs), so I modified all my .pro file to ...
Is thread local storage used anywhere else other than making global and static variables local to a thread?Is it useful in any new code that we write?
...
Is the static keyword in C used only for limiting the scope of a variable to a single file?
I need to know if I understood this right. Please assume the following 3 files,
file1.c
int a;
file2.c
int b;
file3.c
static int c;
Now, if the 3 files are compiled together, then the variables "a" & "b" should have a global scope and ...
Two parts to this:
If a static class can have a static constructor, why can't it have a static destructor?
What is the best workaround? I have a static class that manages a pool of connections that are COM objects, and I need to make sure their connections get closed/released if something blows up elsewhere in the program.
...
I'd like to include files, data and images in a static library API so the users won't need to include them manually in their project.
I see that there isn't obvious way to do it but is there some hack or workaround to achieve this goal ?
Thanks
...
I want to implement a collection, whose items need to be tested for emptiness.
In case of a reference type, one would test for being null. For value types, one has to implement empty testing, and probably choose a specific value that represents emptyness.
My generic collection of T should be usable for both value and reference type valu...
How can i keep static text within a <input type="text" name="site"> text field, just like the tumblr account ***.tumblr.com here > http://www.tumblr.com/
...
Trying to construct a helper class that will return an arraylist, but I'm getting the following error, having to do with the xml document I need to create:
Util.oDocument': cannot declare instance members in a static class
I think I understand why you wouldn't want to create a new xmldoc object each time this method gets called, bu...
im trying to understand the get and set properties for fields, and run in to this issue, can somone explaine to me why i had to make the int X field Static to make this work?
using System;
namespace ConsoleApplication1
{
class Program
{
public static int X = 30;
public static void Main()
{
va...
I'm serving /foo/bar/ by way of proxypass and want to continue doing so. However, I would like to serve /foo/bar/baz.swf statically from say /var/www/mystatic/baz.swf and so forth.
I was hoping that I could do something like
location /foo/bar/(.*) {
alias /var/www/mystatic/;
}
location / {
proxy_pass ....;
...
Is it possible in C++ to have a member function that is both static and virtual? Apperantly, there isn't a straight-forward way to do it (static virtual member(); is a complie error), but at least a way to acheive the same effect?
I.E:
struct Object
{
struct TypeInformation;
static virtual const TypeInformation &GetTypeInfor...
I know in D2010 they have added support for static constructors and destructors.
Where I can find more information about they: syntax and samples?
...
hi folks,
I having trouble serving Django's static admin files on webfaction.
Here's how I'm currently set up:
I've created a 'Symbolic link to
static-only app', and provided the
link to Django admin files in 'extra
info':
/home/myusername/webapps/mydjangoapp/lib/python2.5/django/contrib/admin/media
(cd'ing into that directory works
...