public void Next() { var TestObject = new DefaultGenerator(Canister.Builder.Bootstrapper.Resolve <Mirage.Random>()); var Result = TestObject.Next(typeof(TestClass).GetMethod("TestMethod").GetParameters()[0]); Result.Should().BeOfType <char>(); }
public JavaScriptGenerator() { Writers = new Dictionary<Type, IJavaScriptGenerator>(); Writers[typeof(SimpleParameterEvaluator)] = new SimpleParameterGenerator(); Writers[typeof(ReflectionParameterEvaluator)] = new ReflectionParameterGenerator(); Writers[typeof(PatternLookupEvaluator)] = new PatternLookupGenerator(); Writers[typeof(StringFormatFormatter)] = new StringFormatGenerator(); Writers[typeof(DefaultFormatter)] = new DefaultGenerator(); Writers[typeof(StringCaseFormatter)] = new StringCaseGenerator(); Writers[typeof(TakeAllCondition)] = new TakeAllGenerator(); Writers[typeof(SingleValueCondition<double>)] = new SingleValueGenerator<double>(); Writers[typeof(SingleValueCondition<string>)] = new SingleValueGenerator<string>(); Writers[typeof(ValueListCondition<double>)] = new ValueListGenerator<double>(); Writers[typeof(ValueListCondition<string>)] = new ValueListGenerator<string>(); Writers[typeof(IntervalCondition<double>)] = new IntervalGenerator<double>(); Writers[typeof(IntervalCondition<TimeSpan>)] = new TimespanIntervalWriter(); Writers[typeof(BooleanExpressionCondition)] = new BooleanExpressionGenerator(); Writers[typeof(ArithmeticCondition)] = new ArithmeticGenerator(); Writers[typeof(BooleanExpressionCondition)] = new BooleanExpressionGenerator(); Writers[typeof(LookupCondition)] = new LookupGenerator(); Writers[typeof(HashTagFormatGroupExpander)] = new HashTagFormatGroupExpanderGenerator(); }
public void SetUp() { var generator = new DefaultGenerator(); OpenDungeon = generator.Generate(10, 10); ClosedDungeon = generator.Generate(3, 3); }
public JavaScriptGenerator() { Writers = new Dictionary <Type, IJavaScriptGenerator>(); Writers[typeof(SimpleParameterEvaluator)] = new SimpleParameterGenerator(); Writers[typeof(ReflectionParameterEvaluator)] = new ReflectionParameterGenerator(); Writers[typeof(PatternLookupEvaluator)] = new PatternLookupGenerator(); Writers[typeof(StringFormatFormatter)] = new StringFormatGenerator(); Writers[typeof(DefaultFormatter)] = new DefaultGenerator(); Writers[typeof(StringCaseFormatter)] = new StringCaseGenerator(); Writers[typeof(TakeAllCondition)] = new TakeAllGenerator(); Writers[typeof(SingleValueCondition <double>)] = new SingleValueGenerator <double>(); Writers[typeof(SingleValueCondition <string>)] = new SingleValueGenerator <string>(); Writers[typeof(ValueListCondition <double>)] = new ValueListGenerator <double>(); Writers[typeof(ValueListCondition <string>)] = new ValueListGenerator <string>(); Writers[typeof(IntervalCondition <double>)] = new IntervalGenerator <double>(); Writers[typeof(IntervalCondition <TimeSpan>)] = new TimespanIntervalWriter(); Writers[typeof(BooleanExpressionCondition)] = new BooleanExpressionGenerator(); Writers[typeof(ArithmeticCondition)] = new ArithmeticGenerator(); Writers[typeof(BooleanExpressionCondition)] = new BooleanExpressionGenerator(); Writers[typeof(LookupCondition)] = new LookupGenerator(); Writers[typeof(HashTagFormatGroupExpander)] = new HashTagFormatGroupExpanderGenerator(); }
public void DefaultGenerator() { var setme = "hi"; IGenerator <string> defgen = new DefaultGenerator <string>(setme); var checkme = (string)defgen.Generate(); Assert.IsNotNull(checkme); Assert.AreEqual(checkme, setme); }
public void SetUp() { _configuration = MockRepository.GenerateMock <IAntiCsrfConfiguration>(); _configuration.Stub(arg => arg.Enabled).Return(false); _cookieManager = MockRepository.GenerateMock <IAntiCsrfCookieManager>(); _nonceRepository = MockRepository.GenerateMock <IAntiCsrfNonceRepository>(); _guidFactory = MockRepository.GenerateMock <IGuidFactory>(); _systemClock = MockRepository.GenerateMock <ISystemClock>(); _response = MockRepository.GenerateMock <HttpResponseBase>(); _generator = new DefaultGenerator(_configuration, _cookieManager, _nonceRepository, _guidFactory, _systemClock); }
public void SetUp() { _configuration = MockRepository.GenerateMock <IAntiCsrfConfiguration>(); _configuration.Stub(arg => arg.Enabled).Return(true); _cookieManager = MockRepository.GenerateMock <IAntiCsrfCookieManager>(); _cookieManager.Stub(arg => arg.GetSessionIdAsync(Arg <HttpResponseBase> .Is.Anything)).Return(Task <Guid?> .Factory.Empty()); _nonceRepository = MockRepository.GenerateMock <IAntiCsrfNonceRepository>(); _guidFactory = MockRepository.GenerateMock <IGuidFactory>(); _systemClock = MockRepository.GenerateMock <ISystemClock>(); _response = MockRepository.GenerateMock <HttpResponseBase>(); _generator = new DefaultGenerator(_configuration, _cookieManager, _nonceRepository, _guidFactory, _systemClock); }
/// <summary> /// 处理所有数据列 /// </summary> /// <param name="ctx"></param> void ProcessAllDataColumns(PanelContext ctx) { foreach (We7DataColumn dc in ctx.DataSet.Tables[0].Columns) { if (!String.IsNullOrEmpty(dc.DefaultValue) && dc.Direction != ParameterDirection.ReturnValue && (ctx.Row[dc.Name] == null || String.IsNullOrEmpty(ctx.Row[dc.Name].ToString()))) { if (String.Compare(dc.Name, "AccountID") == 0) { continue; } if (IsEdit && String.Compare(dc.Name, "Updated", true) == 0) { continue; } ctx.Row[dc.Name] = DefaultGenerator.GetDefaultValue(dc.DefaultValue, ctx, dc); } } }
public void SetUp() { _configuration = MockRepository.GenerateMock <IAntiCsrfConfiguration>(); _configuration.Stub(arg => arg.Enabled).Return(true); _configuration.Stub(arg => arg.NonceDuration).Return(TimeSpan.FromMinutes(1)); _configuration.Stub(arg => arg.FormFieldName).Return("name"); _cookieManager = MockRepository.GenerateMock <IAntiCsrfCookieManager>(); _sessionId = Guid.Parse("3ff1a1d6-1604-462e-b347-1314e962ac29"); _cookieManager.Stub(arg => arg.GetSessionIdAsync(Arg <HttpResponseBase> .Is.Anything)).Return(((Guid?)_sessionId).AsCompletedTask()); _nonceRepository = MockRepository.GenerateMock <IAntiCsrfNonceRepository>(); _nonceRepository.Stub(arg => arg.AddAsync(Arg <Guid> .Is.Anything, Arg <Guid> .Is.Anything, Arg <DateTime> .Is.Anything, Arg <DateTime> .Is.Anything)).Return(Task.Factory.Empty()); _guidFactory = MockRepository.GenerateMock <IGuidFactory>(); _nonce = Guid.Parse("4dc041ab-7259-466a-b9a7-846dd9595f4e"); _guidFactory.Stub(arg => arg.Random()).Return(_nonce); _systemClock = MockRepository.GenerateMock <ISystemClock>(); _currentUtcTimestamp = new DateTime(2013, 1, 2); _systemClock.Stub(arg => arg.UtcDateTime).Return(_currentUtcTimestamp); _response = MockRepository.GenerateMock <HttpResponseBase>(); _generator = new DefaultGenerator(_configuration, _cookieManager, _nonceRepository, _guidFactory, _systemClock); _hiddenInputHtml = _generator.GenerateHiddenInputHtmlAsync(_response).Result; }
public void Creation() { var TestObject = new DefaultGenerator(Canister.Builder.Bootstrapper.Resolve <Mirage.Random>()); TestObject.Should().NotBeNull(); }
public void CanGenerate() { var TestObject = new DefaultGenerator(Canister.Builder.Bootstrapper.Resolve <Mirage.Random>()); TestObject.CanGenerate(typeof(TestClass).GetMethod("TestMethod").GetParameters()[0]).Should().BeTrue(); }
private static void PrintDefault(Type type) { Console.WriteLine("default({0}) = {1}", type, DefaultGenerator.GetDefaultValue(type)); }
public void SetUp() { _generator = new DefaultGenerator(); }
public void DefaultGenerator() { var setme = "hi"; IGenerator<string> defgen = new DefaultGenerator<string>(setme); var checkme = (string) defgen.Generate(); Assert.IsNotNull(checkme); Assert.AreEqual(checkme, setme); }