public void ShouldSearchAllRefrencedAsseblies() { var list = TypeHelper.FindListOf <IRoleList>(); var list2 = TypeHelper.FindListOf <IPremissionList>(); var exampleOfInjected = AppObjectFactory.GetContainer().GetInstance <IIdentityManager>(); }
public void ShouldCreateConcreteClassesWithDefaultConvetion() { var c = AppObjectFactory.GetContainer(); var someObj = c.GetInstance <TelegramErrorLoggerFilterAttribute>(); Assert.IsNotNull(someObj); }
public async Task PageServiceAddWithParentTest() { //arrange var userManager = AppObjectFactory.GetContainer().GetInstance <IAppUserManager>(); var identity = new ClaimsIdentity(); identity.AddClaim(new Claim(CustomClaimTypes.Premission, PagePremision.CanManage)); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, (await userManager.FindByNameAsync("mohammadali")).Id.ToString())); var principal = new ClaimsPrincipal(identity); var pageAddRequest = new PageAddRequest() { RequestOwner = principal, ViewModel = new PageAddUpdateViewModel() { Handle = "contactus", UrlSegment = "/contactus", Title = "تماس با ما", LanguageName = "fa-IR", Description = "test", HtmlContent = "<h1>hello</h1>", ParentId = Guid.Parse("5040e22d-739f-404a-9762-9da3f4ca7e22") } }; AutomapperConfiguration.Cofigure(AppObjectFactory.GetContainer()); var service = AppObjectFactory.GetContainer().GetInstance <IPageService>(); var res = service.Add(pageAddRequest); Assert.AreEqual((await res).Access, ResponseAccess.Granted); }
public async Task ShouldCreateNewSchemeTest() { var schemeCreator = AppObjectFactory.GetContainer().GetInstance <IEntitySchemeFacade>(); var serializeSetting = new JsonSerializer() { ContractResolver = new CamelCasePropertyNamesContractResolver() }; await schemeCreator.AddNewSchemeToSystemAsync(new EntitySchemeViewModel() { Handle = "hey i have spaces ", Description = "some dec", Title = "good title", Url = "good url", FieldDefenitions = new List <FieldDefenitionViewModel>() { new FieldDefenitionViewModel() { Handle = "name", Title = "نام", IsRequired = true, Type = "text", DefaultValue = JObject.FromObject(new TextTemplate() { Text = "myname" }, serializeSetting), Order = 1, } } }); }
public void SholuldValidateAvalibleSelectedDropOption() { var factory = AppObjectFactory.GetContainer().GetInstance <CustomFieldFactoryProvider <JObject> >() .GetFieldFactory("dropdown"); Assert.IsInstanceOfType(factory, typeof(DropDownListFieldFactory)); var selectedOption = new DropDownListFieldTemplate() { Name = "طبع گرم", Value = "red" }; var notValidSelectedOption = new DropDownListFieldTemplate() { Value = "blue", Name = "طبع گرم و سرد" }; var dropDownFieldMetaData = new DropDownFieldMetaData() { AvalibleOptions = new List <DropDownListFieldTemplate>() { selectedOption, new DropDownListFieldTemplate() { Name = "طبع سرد", Value = "green" } } }; Assert.IsTrue(factory.IsValidForField(JObject.FromObject(selectedOption), JObject.FromObject(dropDownFieldMetaData))); Assert.IsTrue(factory.IsValidForField(selectedOption.Value, JObject.FromObject(dropDownFieldMetaData))); Assert.IsFalse(factory.IsValidForField(JObject.FromObject(notValidSelectedOption), JObject.FromObject(dropDownFieldMetaData))); Assert.IsFalse(factory.IsValidForField(notValidSelectedOption.Value, JObject.FromObject(dropDownFieldMetaData))); }
public void ShouldFillDependenciesOfAConstructedObj() { var c = AppObjectFactory.GetContainer(); var someObj = new MvcEnableEntityValidationAttribute(); c.BuildUp(someObj); Assert.IsNotNull(someObj.EntitySchemesDataService); }
public async Task ShouldHandleNewItem() { var helper = new ShoppingCartHelper(); var unitOfWork = AppObjectFactory.GetContainer().GetInstance <IUnitOfWork>(); await helper.AddToCartAsync(unitOfWork.Set <Product>().First(), 2, unitOfWork.Set <User>().First(), unitOfWork); }
public void ShouldGetInfrustructureLogics() { var c = AppObjectFactory.GetContainer(); var list = c.GetInstance <List <IBaseBeforeAddingEntityLogic> >(); foreach (var item in list) { Console.WriteLine(item); Assert.IsNotNull(item.Container); } }
public async Task SendEmailTest() { var service = AppObjectFactory.GetContainer().GetInstance <IEmailSecuriyService>(); await service.SendAsync(new IdentityMessage() { Destination = "*****@*****.**", Body = "hello", Subject = "testmessage" }); }
public async Task LoadTimeByOptionsTest() { var productDataService = AppObjectFactory.GetContainer().GetInstance <IProductDataService>(); AutomapperConfiguration.Cofigure(AppObjectFactory.GetContainer()); var stopWatch = new Stopwatch(); stopWatch.Start(); var product = productDataService.Query.IncludeNecessaryData() .FirstOrDefault(); await product.LoadDataByOptionsAsync(AppObjectFactory.GetContainer().GetInstance <IUnitOfWork>()); stopWatch.Stop(); Console.Write(stopWatch.Elapsed + " elapsed"); }
public async Task ShouldNotifyAdminstrators() { HttpContext.Current = new HttpContext( new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()) ); var identity = new ClaimsIdentity(); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, Guid.NewGuid().ToString())); HttpContext.Current.User = new GenericPrincipal(identity, null); await AppObjectFactory.GetContainer().GetInstance <WebSiteOwnerOrderNotifier>() .OrderPaid(new Order() { Id = Guid.NewGuid() }); }
public async Task LoadTimeTest() { var productDataService = AppObjectFactory.GetContainer().GetInstance <IProductDataService>(); var stopWatch = new Stopwatch(); stopWatch.Start(); var product = productDataService.Query.IncludeNecessaryData().Include(x => x.PrimaryCategory) .Include(x => x.PrimaryCategory.FieldDefenitions) .Include(x => x.PrimaryCategory.FieldDefenitionGroups) .Include(x => x.PrimaryCategory.FieldDefenitionGroups.Select(fdg => fdg.FieldDefenitions)) .Include(x => x.Scheme) .Include(x => x.Scheme.FieldDefenitions) .Include(x => x.Scheme.FieldDefenitionGroups) .Include(x => x.Scheme.FieldDefenitionGroups.Select(fdg => fdg.FieldDefenitions)).FirstOrDefault(); stopWatch.Stop(); Console.Write(stopWatch.Elapsed + "elapsed"); }
public void ShouldWireUpDefaultConcereteTypes() { var c = AppObjectFactory.GetContainer(); Assert.IsTrue(c.GetInstance <IFileService>() is FileServiceSubject); }
public void ShouldSendEmail() { InjectibleJob.Container = AppObjectFactory.GetContainer(); new UserMessageNotifier("*****@*****.**", "test", "test").Execute(); }
public UnitTest1() { AutomapperConfiguration.Cofigure(AppObjectFactory.GetContainer()); }
public EntitySchemeFacadeTests() { AutomapperConfiguration.Cofigure(AppObjectFactory.GetContainer()); }
public MenuServiceTests() { AutomapperConfiguration.Cofigure(AppObjectFactory.GetContainer()); }
public void ShouldFindExcutingCodeAssemblyRegistries() { AppObjectFactory.FindRegistries().ForEach(Console.WriteLine); }
public CustomFieldToLiquidTest() { _factroyProvider = AppObjectFactory.GetContainer().GetInstance <CustomFieldFactoryProvider <JObject> >(); }