public void ReturnsCompiledFunc() { // Arrange Mock <ICacheKeyHash> cacheKeyHash = new Mock <ICacheKeyHash>(); cacheKeyHash.Setup(x => x.GetHash(It.IsAny <string>())).Returns("ahash"); IPropertyCacheKeyProviderCompiler subject = new PropertyCacheKeyProviderCompiler(); // Act Func <SimpleCommand, string> func = subject.Compile <SimpleCommand>(cacheKeyHash.Object); // Assert Assert.NotNull(func); }
public void ReturnedFuncCreatesStringFromProperties() { // Arrange IPropertyCacheKeyProviderCompiler subject = new PropertyCacheKeyProviderCompiler(); Mock <ICacheKeyHash> cacheKeyHash = new Mock <ICacheKeyHash>(); cacheKeyHash.Setup(x => x.GetHash(It.IsAny <string>())).Returns("ahash"); Func <SimpleCommand, string> func = subject.Compile <SimpleCommand>(cacheKeyHash.Object); // Act string result = func(new SimpleCommand { AnotherValue = 1, SomeValue = 2 }); // Assert Assert.Equal("ahash", result); }