public void ServiceSaveBulk() { StubDataStore stubDataStore = new StubDataStore(); SimpleService simpleServiceToTest = new SimpleService(stubDataStore); List<ComplexData> cds = new List<ComplexData>(); for (int i = 0; i < 100; i++) { Guid theID = Guid.NewGuid(); string randomName = Utilities.RandomString(10); var complexData = new ComplexData(theID, randomName, new List<SubitemData>() { }, ComplexDataTypeEnum.Complex); cds.Add(complexData); } simpleServiceToTest.BulkSaveComplexData(cds); foreach (var cd in cds) { var retcd = simpleServiceToTest.GetComplexData(cd.Id); Assert.Equal(cd, retcd); } }
public void SaveComplexData(ComplexData dataComplex) { var client = new MongoClient(ConnectionString); var server = client.GetServer(); var database = server.GetDatabase(dataBaseName); var collection = database.GetCollection<ComplexData>(complexCollectionName); collection.Insert(dataComplex); }
public void SaveComplexData(ComplexData saveData) { if(saveData == null) { throw new ArgumentNullException("saveData"); } DataStore.SaveComplexData(saveData); }
public static ComplexData GetRandomComplexData(int nameSize = 10, int maxSubItems = 50) { ComplexData cd = new ComplexData(); cd.Id = Guid.NewGuid(); cd.Name = Utilities.RandomString(nameSize); var totalSubItems = random.Next(maxSubItems); cd.SubItems = new List<SubitemData>(totalSubItems); for(int i =0; i < totalSubItems; i++) { cd.SubItems.Add(GetRandomSubItemData(nameSize)); } cd.DataType = GetRandomEnumValue(); return cd; }
public void SaveComplexData(ComplexData dataComplex) { ComplexData.Add(dataComplex); }