5

I'm working on a project where some parts of the system rely on Active Directory. However, I'm at the client's office, where I cannot access their AD(Red tape).

Is there a way to mock AD while I develop?

I'm developing in C# and .NET

Niel de Wet
  • 7,806
  • 9
  • 63
  • 100
  • A VM running Windows Server is probably the easiest thing to use. – Anya Shenanigans Jan 04 '13 at 10:51
  • "Is there a way to mock AD while I develop?" It depends on what parts of AD you actually rely on. Could you elaborate more? – Wiktor Zychla Jan 04 '13 at 11:40
  • @WiktorZychla, our service needs to query the AD for user groups and email addresses. The challenge is that our dev machines are not on the client's domain. I suppose that's where TomTom's answer becomes relevant. – Niel de Wet Jan 04 '13 at 12:22
  • Possible duplicate of [How to fake Active Directory?](http://stackoverflow.com/questions/12354107/how-to-fake-active-directory) – Owen Pauling Mar 29 '16 at 20:20

3 Answers3

6

our service needs to query the AD for user groups and email addresses

Another option then would be to implement the AD access with the repository pattern and have at least two implementations.

public interface IRepository 
{
    IEnumerable<Something> GetUsers();
}

public class ActiveDirectoryRepository : IRepository ...

public class AnotherRepository : IRepository ...

This way you could easily switch to required implementation at the deployment time - you develop against database, xmlfiles, memory, anything but the deployed application talks to the AD - because you code against the repository interface, you just reconfigure the application and have ZERO changes in the code.

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106
4

You could use Active Directory Lightweight Directory Service (used to be called ADAM). This allows you to setup a multi-user AD environment.

http://blogs.technet.com/b/askds/

Quinton Bernhardt
  • 4,773
  • 19
  • 28
  • -1. Not possibly - you ahve to redo all the schemata, then you still miss the security part (kerberos). – TomTom Jan 04 '13 at 11:45
  • 2
    +1, another useful answer you downvoted just because you propose a completely different approach. Plus, the OP does not mention kerberos, that's why I asked about it. – Wiktor Zychla Jan 04 '13 at 15:45
  • 2
    @TomTom: I find your comments slightly offensive. I haven't mention any "Hello Worlds", burgers or anything like that. I respect your experience and I just asked if you ever developed software in distributed teams, where you just HAVE to rely on someone else's code and you don't verify it (it is not your responsibility to test someone else's work). OP clearly mentions he wants to MOCK the AD, isolation or emulation are as good approaches as yours. We don't have to agree but I don't think it is fair to downvote all other answers but yours. – Wiktor Zychla Jan 04 '13 at 16:06
  • 2
    @TomTom: I respect your opinions and your judgements do not make your opinions more valid. Do we know each other personally maybe? Although I can't be sure (googling "TomTom" doesn't help), I can't believe you would write such an elaboration on me based on this one isolated view on such a specific topic. – Wiktor Zychla Jan 04 '13 at 18:50
0

And this is where "Professional" and "development environment" comes in.

The client has to have a separate environment for development, with AD servers etc. This is where virtualization comes in VERY handy, to set up a number of small low power virtual machines to run AD and all other required services.

Have one (or more) separate networks, isolated, with separate domains, and develop using them.

Standard practice.

TomTom
  • 61,059
  • 10
  • 88
  • 148