public void ProductValidation_Category() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); Product product = JsonConvert.DeserializeObject <Product>("{Name: \"Tennis Shoes\", Id: \"1234\"}"); productUpdator.Create(product); }
public void TestAlreadyExists() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); var product = JsonConvert.DeserializeObject <Product>("{Id: '1'}"); productUpdator.Create(product); }
public void ProductValidation_Name() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); Product product = JsonConvert.DeserializeObject <Product>("{ProductCategoryId: 1, Id: \"1234\"}"); productUpdator.Create(product); }
public void ProductValidation_UpdateException() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); Product product = JsonConvert.DeserializeObject <Product>("{ProductCategoryId: 1, Name: \"Tennis Shoes\", Id: ''}"); productUpdator.Update(product); }
public void TestInvalidIdException4() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); var product = JsonConvert.DeserializeObject <Product>("{Id: '" + Guid.Empty + "'}"); productUpdator.Create(product); }
public void GetTest() { Product product = MefBase.Resolve <IProductSelector>().Get("1"); Assert.IsTrue(product.Name == "Babolat Pure Control Tour"); Assert.IsTrue(product.StandardCost == 159.00M); Assert.IsTrue(product.ProductCategoryId == 1); }
static void Main(string[] args) { MefBase <ClassA> tmpMef = new MefBase <ClassA>(); MefBase <ClassB> tmpMefB = new MefBase <ClassB>(); List <ClassA> tmpA = tmpMef.GetPlugin("1"); tmpA[0].A = ""; }
public static void Initialize() { AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); catalog.Catalogs.Add(new AssemblyCatalog(typeof(BusinessMasterDataAssembly).Assembly)); MefBase.SetContainer(new CompositionContainer(catalog)); }
public void DeleteTest() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); IProductSelector productSelector = MefBase.Resolve <IProductSelector>(); Assert.IsTrue(productSelector.FindAll(true).Count == 15); productUpdator.Delete("5"); Assert.IsTrue(productSelector.FindAll(true).Count == 14); }
public void InitializeTest() { GenericIdentity identity = new GenericIdentity("jsucupira"); string[] roles = { SecurityGroups.ADMINISTRATOR }; GenericPrincipal principal = new GenericPrincipal(identity, roles); Thread.CurrentPrincipal = principal; MefLoader.Initialize(); IStoreRepository repository = MefBase.Resolve <IStoreRepository>(); StoreSelector = MefBase.Resolve <IStoreSelector>(); StoreUpdator = MefBase.Resolve <IStoreUpdator>(); SamplerOptions samplerOptions = new SamplerOptions(); samplerOptions.PropertyDefaults.Add(new PropertiesSettings { PropertyValue = "*****@*****.**", PropertyName = nameof(Store.ManagerEmail) }, SamplerOptions.Options.DefaultValue); samplerOptions.PropertyDefaults.Add(new PropertiesSettings { PropertyValue = "http://www.test.com/", PropertyName = nameof(Store.WebSiteUrl) }, SamplerOptions.Options.DefaultValue); samplerOptions.PropertyOptions.Add(nameof(Store.Description), SamplerOptions.Options.Paragraph); samplerOptions.PropertyOptions.Add(nameof(Store.Name), SamplerOptions.Options.OneWord); samplerOptions.PropertyOptions.Add(nameof(Store.ManagerName), SamplerOptions.Options.OneWord); List <Store> stores = SamplerServices <Store> .CreateSampleData(ACTIVE_STORES - 1, samplerOptions); stores.ForEach(t => t.Activate()); //Creating active classes stores.ForEach(t => repository.Create(t)); //Creating non active classes SamplerServices <Store> .CreateSampleData(NON_ACTIVE_STORES, samplerOptions).ForEach(t => repository.Create(t)); samplerOptions.PropertyDefaults.Add(new PropertiesSettings { PropertyName = nameof(Store.Id), PropertyValue = DefaultStoreId.ToString() }, SamplerOptions.Options.DefaultValue); List <Store> defaultStore = SamplerServices <Store> .CreateSampleData(1, samplerOptions); defaultStore.ForEach(t => t.Activate()); defaultStore.ForEach(t => repository.Create(t)); }
public void Init() { GenericIdentity identity = new GenericIdentity("jsucupira"); string[] roles = { SecurityGroups.ADMINISTRATOR }; GenericPrincipal principal = new GenericPrincipal(identity, roles); Thread.CurrentPrincipal = principal; MefLoader.Initialize(); IProductRepository repository = MefBase.Resolve <IProductRepository>(); ProductTestData.Products.ForEach(t => t.Activate()); ProductTestData.Products.ForEach(t => repository.Create(t)); }
public void UpdateTest() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); IProductSelector productSelector = MefBase.Resolve <IProductSelector>(); Product product = productSelector.Get("4"); Assert.IsTrue(product.Description == "With roots that extend all the way back to the Wilson Ultra and legendary Pro Staff 6.0 85, the Pro Staff 90 is a true classic. This one is built for advanced players in search of incredible feel, rock solid stability and surgical precision. Featuring the ultimate player's specs, the Pro Staff 90 includes a 12+ oz weight, headlight balance, thin beam, leather grip and Wilson's tried and true Graphite/Kevlar Layup. It also has Amplifeel Technology in the handle to filter out some of the harsher vibrations. All told these ingredients add up to an unmatched level of feel, precision and plow-through. From the baseline the control on full swings is simply amazing, as is the unmistakably sublime feel when contact is cleanly made. There's also some penetrating power available to those who can get the mass moving. At net the Pro Staff 90 provides remarkable stability and pinpoint accuracy, with enough weight to punch the ball deep. All in all, this venerable racquet is simply a great option for any serious player who wants to experience the ultimate in precision and stability along with that timeless Pro Staff feel."); Assert.IsTrue(product.Name == "Wilson Pro Staff 90"); Assert.IsTrue(product.ProductCategoryId == 1); product.Description = "Updated Description"; product.Name = "Updated Name"; product.ProductCategoryId = 1; productUpdator.Update(product); product = productSelector.Get("4"); Assert.IsTrue(product.Description == "Updated Description"); Assert.IsTrue(product.Name == "Updated Name"); Assert.IsTrue(product.LastModifiedBy == "jsucupira"); }
public void Cleanup() { IStoreRepository context = MefBase.Resolve <IStoreRepository>(); context.FindAll().ForEach(t => context.Delete(t.Id)); }
public void ProductValidation_UpdateException2() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); productUpdator.Update(null); }
public void TestNullException() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); productUpdator.Create(null); }
public void TestDeleteException4() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); productUpdator.Delete(Guid.Empty.ToString()); }
public void Cleanup() { IProductRepository context = MefBase.Resolve <IProductRepository>(); ProductTestData.Products.ForEach(t => context.Delete(t.Id)); }
public void Get_Exceptions3() { IProductSelector productSelector = MefBase.Resolve <IProductSelector>(); productSelector.Get(Guid.Empty.ToString()); }
public void Get_Exceptions5() { IProductSelector productSelector = MefBase.Resolve <IProductSelector>(); productSelector.Get("123"); }
public void Get_Exceptions2() { IProductSelector productSelector = MefBase.Resolve <IProductSelector>(); productSelector.Get(string.Empty); }
public void DeleteWithoutId() { MefBase.Resolve <IProductUpdator>().Delete(null); }
public void FindAllTest() { IProductSelector selector = MefBase.Resolve <IProductSelector>(); Assert.IsTrue(selector.FindAll(true).Count == 15, $"Actual {selector.FindAll(true).Count}"); }
public void GetBadIdTest() { MefBase.Resolve <IProductSelector>().Get(""); }
public void GetNonExistentTest() { MefBase.Resolve <IProductSelector>().Get("adwda"); }
public void TestDeleteException3() { IProductUpdator productUpdator = MefBase.Resolve <IProductUpdator>(); productUpdator.Delete("0"); }
public Form1() { InitializeComponent(); MefBase.ComposeParts(this); }