public void testInitialize() { _goPro = new GoProDuskWhite(); _storage = new GenericStorage(); _service = new TakePicture(_goPro, _storage); }
public void GenericMethodInStaticProtoTest() { GenericStorage<int>.StaticPrototype.SetMeAnd2Objects_2<string,int>((x, y, z) => { return "test"; }); GenericStorage<int> test = new GenericStorage<int>(10); Assert.That(test.MeAnd2Objects<string, int>(10, "a") == "test"); }
public void GemericMethodsTest() { GenericStorage<int> a = new GenericStorage<int>(5); a.GenericStorage_1Prototype.SetMeAnd2Objects_2<int, int>((x, y, z) => { return "Hi, together we are "+(x.Data + y + z).ToString(); }); Assert.That(a.MeAnd2Objects<int, int>(10, 20) == "Hi, together we are 35"); }
public CachedStorage(IServiceProvider services, CachedStorageOptions options, IRedisClient redis, ILogger <CachedStorage> logger, RecyclableMemoryStreamManager memory) { _impl = new GenericStorage(services, options.Inner); _options = options; _redis = redis; _logger = logger; _memory = memory; }
private void CalculateMovements() { GenericStorage <double> wqueue = Const.OpcDatasource.WalkingQueue_Plc, yqueue = Const.OpcDatasource.YawQueue_Plc; //Const.OpcDatasource.WalkingSpeed_Plc = wqueue == null ? 0 : Math.Round(wqueue.ElementAt(2) - wqueue.ElementAt(1), 3); Const.OpcDatasource.WalkingAcce_Plc = wqueue == null ? 0 : Math.Round(wqueue.ElementAt(0) - 2 * wqueue.ElementAt(1) + wqueue.ElementAt(2), 3); //Const.OpcDatasource.YawSpeed_Plc = yqueue == null ? 0 : Math.Round(yqueue.ElementAt(1) - yqueue.ElementAt(0), 3); }
/// <summary> /// 构造器 /// </summary> public OpcDataSource() { PlcReadable = true; PlcWritable = true; WalkingQueue_Plc = new GenericStorage <double>(3); YawQueue_Plc = new GenericStorage <double>(2); WalkingQueue_Plc.FillEmptyShells(); YawQueue_Plc.FillEmptyShells(); }
public void InstancePrototypeCallTest() { GenericStorage<string> a = new GenericStorage<string>("test_failed"); a.GenericStorage_1Prototype.get_Data = (self) => "test_completed"; Assert.That(a.Data == "test_completed"); GenericStorage<int> b = new GenericStorage<int>(10); GenericStorage<int>.StaticPrototype.IntroduceItselfStatic = () => "static_test_completed"; Assert.That(GenericStorage<int>.IntroduceItselfStatic() == "static_test_completed"); }
public void CtorTest() { GenericStorage<string>.StaticPrototype.Ctor_T = (self, value) => { self.Info = "cerated_by_test"; self.xCtor(value); }; var a = new GenericStorage<string>("abc"); Assert.That(a.Info == "cerated_by_test"); Assert.That(a.Data == "abc"); }
public void CrazyTest() { GenericStorage<GenericStorage<string>>.StaticPrototype.SetMeAnd2Objects_2<GenericStorage<bool>,GenericStorage<GenericStorage<int>>>( (x,y,z) => { return x.Data.Data.ToString() + y.Data.Data.ToString() + z.Data.ToString(); } ); GenericStorage<GenericStorage<string>> a = new GenericStorage<GenericStorage<string>>(new GenericStorage<string>("Yes! I am string!")); var result = a.MeAnd2Objects<GenericStorage<bool>, GenericStorage<GenericStorage<int>>>( new GenericStorage<GenericStorage<int>>(new GenericStorage<int>(2)), new GenericStorage<bool>(true)); Assert.That(result == "Yes! I am string!2True"); }
static bool TryGet(string key, out string value) { GenericStorage<string> emptyItem = new GenericStorage<string>(key); RelayClient.Instance.GetObject(emptyItem); if (emptyItem.DataSource == DataSource.Cache) { value = emptyItem.Payload; return true; } value = String.Empty; return false; }
static bool TryGet(string key, out string value) { GenericStorage <string> emptyItem = new GenericStorage <string>(key); RelayClient.Instance.GetObject(emptyItem); if (emptyItem.DataSource == DataSource.Cache) { value = emptyItem.Payload; return(true); } value = String.Empty; return(false); }
public async Task CreateAndReadSchemaAsync() { var personSchemaAsString = " { \"title\": \"Person\" , \"type\": \"object\", \"eav-primary-key\":\"myid\", \"properties\": { \"myid\": { }, \"firstName\": { }, \"lastName\": { }, } } "; var personSchema = JObject.Parse(personSchemaAsString); var eav = new EavMemoryStorage(); var service = new GenericStorage(eav); await service.Schema.CreateWithSpecifiedIdAsync((string)personSchema["title"], personSchema); var readSchema = await service.Schema.ReadAsync((string)personSchema["title"]); Assert.IsNotNull(readSchema); Assert.AreEqual(5, readSchema.Count); }
public async Task CreateAndReadSchemaAsync_WithAttributeType() { var personSchemaAsString = " { \"title\": \"Person\" , \"type\": \"object\", \"eav-primary-key\":\"myid\", \"properties\": { \"myid\": { \"type\": \"Guid\"}, \"firstName\": { \"type\": \"string\" }, \"lastName\": { \"type\": \"string\" }, \"age\": { \"type\": \"number\" } } } "; var personSchema = JObject.Parse(personSchemaAsString); var eav = new EavMemoryStorage(); var service = new GenericStorage(eav); await service.Schema.CreateWithSpecifiedIdAsync((string)personSchema["title"], personSchema); var personObjectAsString = " {\"firstName\" : \"Lars\", \"lastName\": \"Lindberg\" , \"age\": 47 } "; var personObject = JObject.Parse(personObjectAsString); var objectId = await service.Object.CreateAsync((string)personSchema["title"], personObject); var readData = await service.Object.ReadAsync((string)personSchema["title"], objectId); Assert.IsNotNull(readData); Assert.AreEqual(3, readData.Count); }
public async Task CreateAndReadSchema_Withid() { var personSchemaAsString = " { \"$id\": \"https://example.com/person.schema.json \", " + " \"$schema\": \"http://json-schema.org/draft-07/schema# \", " + " \"title\": \"Person\" , " + " \"type\": \"object\", " + " \"eav-primary-key\":\"myid\", " + " \"properties\": { \"myid\": { \"type\": \"Guid\"}, \"firstName\": { \"type\": \"string\" }, \"lastName\": { \"type\": \"string\" }, \"age\": { \"type\": \"number\" } } } "; var personSchema = JObject.Parse(personSchemaAsString); // Memory Storage var eav = new EavMemoryStorage(); var service = new GenericStorage(eav); await service.Schema.CreateWithSpecifiedIdAsync((string)personSchema["title"], personSchema); var readSchema = await service.Schema.ReadAsync((string)personSchema["title"]); Assert.IsNotNull(readSchema); Assert.AreEqual(6, readSchema.Count); }
public async Task CreateAndReadSchema_AttributeType_String() { var personSchemaAsString = " { \"title\": \"Person\" , \"type\": \"object\", \"eav-primary-key\":\"myid\", \"properties\": { \"myid\": { \"type\": \"Guid\"}, \"firstName\": { \"type\": \"string\" }, \"lastName\": { \"type\": \"string\" }, \"age\": { \"type\": \"integer\" } } } "; var personSchema = JObject.Parse(personSchemaAsString); var eav = new EavMemoryStorage(); var service = new GenericStorage(eav); await service.Schema.CreateWithSpecifiedIdAsync((string)personSchema["title"], personSchema); var readSchema = await service.Schema.ReadAsync((string)personSchema["title"]); Assert.IsNotNull(readSchema); Assert.AreEqual(5, readSchema.Count); int result = 0; // Looping the Properties schema var propertySchema = readSchema["properties"]; Assert.IsNotNull(propertySchema); Assert.AreEqual(4, propertySchema.Count()); foreach (var rSchema in propertySchema) { Assert.IsNotNull(rSchema); Assert.AreEqual(1, rSchema.Count()); foreach (var attributeType in rSchema) { if (attributeType["type"].ToString() == "string") { result = result + 1; } } } Assert.AreEqual(2, result); }
static void Save(string key, string value) { GenericStorage<string> item = new GenericStorage<string>(key, value); RelayClient.Instance.SaveObject(item); }
static void Delete(string key) { GenericStorage <string> emptyItem = new GenericStorage <string>(key); RelayClient.Instance.DeleteObject(emptyItem); }
public ContactsController(IMyDatabase myDatabase) { _myDatabase = myDatabase; _storage = new GenericStorage(); }
static void Save(string key, string value) { GenericStorage <string> item = new GenericStorage <string>(key, value); RelayClient.Instance.SaveObject(item); }
public void StaticPrototypeCallTest() { GenericStorage<int>.StaticPrototype.IntroduceItself = (self) => { return "test"; }; GenericStorage<int> a = new GenericStorage<int>(10); Assert.That(a.IntroduceItself() == "test"); }
public AgendaController() { _storage = new GenericStorage(); }
public TakePicture(GoProDuskWhite goPro, GenericStorage storage) { _goPro = goPro; _storage = storage; }
public MoveRover(GenericStorage storage) { _storage = storage; }
public ContactsController() { _storage = new GenericStorage(); }
public void testInitialize() { _storage = new GenericStorage(); _service = new MoveRover(_storage); }
public void MicedGenericInGenericTest() { GenericStorage<GenericStorage<string>> a = new GenericStorage<GenericStorage<string>>(new GenericStorage<string>("Something to do here...")); a.Data.GenericStorage_1Prototype.get_Data = (self) => "nothing to do here!"; Assert.That(a.Data.Data == "nothing to do here!"); }
public void StaticAndDynamicProtoOverrideTest() { GenericStorage<int> test = new GenericStorage<int>(); test.GenericStorage_1Prototype = new GenericStorage<int>.PrototypeClass(); test.GenericStorage_1Prototype.SetMakeMeSome_2<int,string>((x, y, z) => { return 30; }); GenericStorage<int>.StaticPrototype.SetMakeMeSome_2<int, string>((x, y, z) => { return 20; }); Assert.That(test.MakeMeSome<int, string>("s", 10) == 30); }
public CountryController() { _storage = new GenericStorage(); }
static void Delete(string key) { GenericStorage<string> emptyItem = new GenericStorage<string>(key); RelayClient.Instance.DeleteObject(emptyItem); }
public GenericStorageTests() { _storage = new GenericStorage <int, string>(); }
public void SimplePrototypeCallTest() { GenericStorage<int> a = new GenericStorage<int>(10); string[] strs = { a.IntroduceItself(), a.IntroduceItself("Hello, i am"), a.xIntroduceItself(), a.xIntroduceItself("Hello, i am") }; Assert.That(strs.All(s => s == "Hello, i am System.Int32")); }
public SensordatasController() { _storage = new GenericStorage(); }
/// <summary> /// Constructor /// </summary> public ProductsController() { _storage = new GenericStorage(); }
public void GenericInGenericTest() { GenericStorage<List<int>> TestLists = new GenericStorage<List<int>>(); TestLists.GenericStorage_1Prototype.get_Data = (self) => { return new List<int> { 1, 2, 3 }; }; Assert.That(TestLists.Data.ToArray().All(e => e == TestLists.Data.IndexOf(e) + 1)); }
public SQLiteProductStorage(StorageContext context) { _productStorage = new GenericStorage <ProductDto, StorageContext>(context); _productTypeStorage = new GenericStorage <ProductTypeDto, StorageContext>(context); _productBrandStorage = new GenericStorage <ProductBrandDto, StorageContext>(context); }
public SqlMapConfigProvider() { _sqlMapConfigs = new GenericStorage <string, SqlMapConfig>(); }
public ContactsController() { _storage = new GenericStorage(); }
public VideoGameController() { _storage = new GenericStorage(); }