Added MoqData which is an Autofixture attribute that uses Mutagen.Bethesda.Testing, but with a Moq backing instead
Added a test for MissingAssetsAnalyzerTests, just to give a little proof of concept.
Few things I like about it
Easier MissingAssetsAnalyzer sut instantiation.
Didn't need to even interact with ILogger or MockFileSystem. Didn't care to access/use them, so they're hidden away.
Side note:
In the situations where we did care about dependency X of a SUT we were testing, we can still opt in to get access to just that one:
public void SomeOtherTest(
[Frozen] Mock<ISomeDependencyOurAnalyzerHas> dep
MissingAssetsAnalyzer analyzer)
{
dep.Setup(x => x.SomeMember).Returns(45);
// ...
If MissingAssetsAnalyzer had 6 dependencies, we still dont have to deal with most of them, while getting access to the one we want to mock it as we like. [Frozen] ensures the mock is a singleton so the one we're getting is also the one passed to the sut
Easy existing file test
Since the MoqData attribute is making our MockFileSystem and injecting it into our analyzer for us, we can just define FilePath existingDiffuse and it will make a file that exists within the file system for us.
This made for a very easy TestExistingTextureSetTextures where I didn't have to spam the page doing all the fileSystem.File.CreateFile(somePath) prep. Just used the paths in the TextureSet mock and then good to go
General Thoughts
I dont think it needs to be used by everyone contributing if they prefer without, but I'd like to have it on the toolbelt for when I'm writing tests myself.
Added
MoqData
which is an Autofixture attribute that usesMutagen.Bethesda.Testing
, but with a Moq backing insteadAdded a test for
MissingAssetsAnalyzerTests
, just to give a little proof of concept.Few things I like about it
Easier
MissingAssetsAnalyzer
sut instantiation.Didn't need to even interact with ILogger or MockFileSystem. Didn't care to access/use them, so they're hidden away.
Side note: In the situations where we did care about dependency X of a SUT we were testing, we can still opt in to get access to just that one:
If
MissingAssetsAnalyzer
had 6 dependencies, we still dont have to deal with most of them, while getting access to the one we want to mock it as we like.[Frozen]
ensures the mock is a singleton so the one we're getting is also the one passed to the sutEasy existing file test
Since the MoqData attribute is making our
MockFileSystem
and injecting it into our analyzer for us, we can just defineFilePath existingDiffuse
and it will make a file that exists within the file system for us.This made for a very easy
TestExistingTextureSetTextures
where I didn't have to spam the page doing all thefileSystem.File.CreateFile(somePath)
prep. Just used the paths in the TextureSet mock and then good to goGeneral Thoughts
I dont think it needs to be used by everyone contributing if they prefer without, but I'd like to have it on the toolbelt for when I'm writing tests myself.