We use the commercial version of JustMock and are working on a new prototype. Along the way, somehow, my Mock.Arranges for one test class have stopped working.
These are tests for our Azure KeyVault Wrapper and are super simple.
IKeyVault keyVault;
[SetUp]
public void SetUp()
{
var keyVaultClient = Mock.Create<IKeyVaultClient>();
Mock.Arrange(() => keyVaultClient.GetSecretAsync("http://www.myKeyStore.com/Key1", new CancellationToken()))
.Returns(Task.FromResult(new SecretBundle { Value = "Secret1" }));
Mock.Arrange(() => keyVaultClient.GetSecretAsync("http://www.myKeyStore.com/Key2", new CancellationToken()))
.Returns(Task.FromResult(default(SecretBundle)));
keyVault = new KeyVault(keyVaultClient);
}
[Test]
public async Task NewSecret_ShouldSucceed()
{
var secret = await keyVault.GetSecretAsync("Key1");
Assert.AreEqual("Secret1", secret);
}
[Test]
public async Task ShouldReturnNull_GetSecretAsync()
{
var secret = await keyVault.GetSecretAsync("Key2");
Assert.AreEqual(null, secret);
}
Both tests are returning SecretBundle objects with all default fields which seems to be an implementation from JustMock (not default(SecretBundle)). Neither have the correct values. The Arrange is simply not working.
I suspect this has something to do with references no longer being updated from Lite to Commercial, but I have no idea how to update them. The Update Reference button in the JustMock menu doesn't seem to do anything.
Any help on how to troubleshoot would be much appreciated. We plan to depend heavily on JustMock for testing this project. Note that these tests, in their current form, were working just fine and the underlying code hasn't changed.
-Geoff