public async Task VariablesShouldBeCleared([Frozen] Mock <IOctopusAsyncRepository> mockRepo, [Frozen] Mock <IVariableSetRepository> mockVar, [Frozen] Mock <ILibraryVariableSetRepository> mockLib, LibraryVariableSetResource libResource, VariableSetResource varResource, LibraryManager sut) { mockLib.Setup(m => m.FindByName(It.Is <string>(s => s.Equals(libResource.Name)), It.IsAny <string>(), It.IsAny <string>())) .Returns(Task.FromResult(libResource)); mockVar.Setup(m => m.Get(It.Is <string>(s => s.Equals(varResource.Id)))) .Returns(Task.FromResult(varResource)); mockRepo.Setup(m => m.VariableSets).Returns(mockVar.Object); var expected = varResource.Variables.Count; var actual = await sut.ClearLibrarySet(libResource.Name).ConfigureAwait(false); Assert.Equal(expected, actual); }