public IMapping Guid(string field) { FuncProvider <Guid> provider = new FuncProvider <Guid>(() => System.Guid.NewGuid()); listOfFields.Add(field, provider); return(this); }
public void TypeOfProvider() { Func <string> testFunction = () => { return(string.Empty); }; FuncProvider <string> provider = new FuncProvider <string>(testFunction); Assert.Equal(typeof(string), provider.TType); Assert.Equal(ProviderType.Func, provider.Type); }
public void StringFuncWithTType() { Func <string> testFunction = () => { return(string.Empty); }; FuncProvider <string> provider = new FuncProvider <string>(testFunction); Assert.Equal(testFunction, provider.DefinedFunc); }
public void ConstructorWithFuncProvider() { Func <string> testFunction = () => { return(string.Empty); }; IDataProvider provider = new FuncProvider <string>(testFunction); var settings = new JsonFieldSettings("id", provider); Assert.Equal("id", settings.Fields); Assert.Equal(ProviderType.Func.ToString(), settings.Type); }
public void StringFuncWithDefinedFunc() { var counter = 0; Func <string> testFunction = () => { counter++; return(string.Empty); }; FuncProvider <string> provider = new FuncProvider <string>(testFunction); Assert.Equal(testFunction, provider.DefinedFunc); }
public void StringFuncWithMoveNext() { Func <string> testFunction = () => { Assert.True(true, "Delegate function is called."); return(string.Empty); }; FuncProvider <string> provider = new FuncProvider <string>(testFunction); provider.MoveNext(null); //Assert.Equal(string.Empty, provider.Current); }
public void StringFuncWithMoveNexMultipleTimes() { var counter = 0; Func <string> testFunction = () => { counter++; return(string.Empty); }; FuncProvider <string> provider = new FuncProvider <string>(testFunction); for (int i = 0; i < 10; i++) { provider.MoveNext(null); } Assert.Equal(10, counter); }
public FuncProviderTests() { this.funcFactoryMock = new Mock <IFunctionFactory>(); this.resolutionRoot = new Mock <IResolutionRoot>().Object; this.testee = new FuncProvider(this.funcFactoryMock.Object, ctx => this.resolutionRoot); }
public FuncProviderTests() { this.funcFactoryMock = new Mock<IFunctionFactory>(); this.resolutionRoot = new Mock<IResolutionRoot>().Object; this.testee = new FuncProvider(this.funcFactoryMock.Object, ctx => this.resolutionRoot); }