Testura.Code.UnitTestGenerator is a simple framework/tool to inspect assemblies and generate unit tests from exported types. It's created as a simple example on how you can use Testura.Code
https://github.com/Testura/Testura.Code.UnitTestGenerator/releases
- MsTest
- NUnit
- Moq
- A unit test file for all types that are exported and isn't static or abstract
- A setUp that initialize the type under test (TuT) by looking at it's first constructor.
- All required parameters will either be mocked, initialized or set to some default value.
- Will generate fields for TuT and required parameters
- All files created will follw your assembly namespace/directory strcture.
var unitTestGenerator = new UnitTestGenerator();
unitTestGenerator.GenerateUnitTests(DllPath, TestFrameworks.NUnit, MockFrameworks.Moq, OutputDirectory);
namespace Testura.Android.Device.Services.Default
{
public class UiService
{
public UiService(IScreenDumper screenDumper, SomeClass someClass, string myString, int number)
{
}
}
}
namespace Testura.Android.Tests.Device.Services.Default
{
[TestFixture]
public class UiServiceTest
{
private Mock<IScreenDumper> screenDumperMock;
private SomeClass someClass;
private UIService uiService;
[SetUp]
public SetUp()
{
screenDumperMock = new Mock<IScreenDumper>();
uiService = new UiService(screenDumperMock.Object, someClass, string.Empty, 0)
}
}
}