public void ShouldInsertObjectWithSingleNullArrayItem() { // prerequisites _database .Create.Class<TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.StringArray = new string[] { null }; var insert = _database .Insert(profile); TestProfileClassExtended insertedDocument = insert .Run<TestProfileClassExtended>(); Assert.True(insertedDocument.ORID != null); Assert.Equal(insertedDocument.OClassName, typeof(TestProfileClassExtended).Name); Assert.Equal(insertedDocument.Name, profile.Name); Assert.Equal(insertedDocument.Surname, profile.Surname); Assert.NotNull(insertedDocument.StringArray); Assert.Equal(insertedDocument.StringArray.Length, 1); }
public void ShouldInsertObjectWithNullStringArrayValues() { // prerequisites _database .Create.Class <TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.StringArray = new string[] { "Test string", null }; var insert = _database .Insert(profile); TestProfileClassExtended insertedDocument = insert .Run <TestProfileClassExtended>(); Assert.IsTrue(insertedDocument.ORID != null); Assert.AreEqual(insertedDocument.OClassName, typeof(TestProfileClassExtended).Name); Assert.AreEqual(insertedDocument.Name, profile.Name); Assert.AreEqual(insertedDocument.Surname, profile.Surname); Assert.IsNotNull(insertedDocument.StringArray); Assert.AreEqual(insertedDocument.StringArray.Length, 2); Assert.IsNotNull(insertedDocument.StringArray[0]); Assert.IsNull(insertedDocument.StringArray[1]); }
public void ShouldInsertObjectWithSingleNullArrayItem() { // prerequisites _database .Create.Class <TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.StringArray = new string[] { null }; var insert = _database .Insert(profile); TestProfileClassExtended insertedDocument = insert .Run <TestProfileClassExtended>(); Assert.True(insertedDocument.ORID != null); Assert.Equal(insertedDocument.OClassName, typeof(TestProfileClassExtended).Name); Assert.Equal(insertedDocument.Name, profile.Name); Assert.Equal(insertedDocument.Surname, profile.Surname); Assert.NotNull(insertedDocument.StringArray); Assert.Equal(insertedDocument.StringArray.Length, 1); }
public void ShouldInsertObjectWithNullStringArrayValues() { // prerequisites _database .Create.Class<TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.StringArray = new string[] { "Test string", null }; var insert = _database .Insert(profile); TestProfileClassExtended insertedDocument = insert .Run<TestProfileClassExtended>(); Assert.IsTrue(insertedDocument.ORID != null); Assert.AreEqual(insertedDocument.OClassName, typeof(TestProfileClassExtended).Name); Assert.AreEqual(insertedDocument.Name, profile.Name); Assert.AreEqual(insertedDocument.Surname, profile.Surname); Assert.IsNotNull(insertedDocument.StringArray); Assert.AreEqual(insertedDocument.StringArray.Length, 2); Assert.IsNotNull(insertedDocument.StringArray[0]); Assert.IsNull(insertedDocument.StringArray[1]); }
public void ShouldInsertObjectWithNestedObject() { // prerequisites _database .Create.Class<TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.Dictionary = new Dictionary<string, string>(); profile.Dictionary.Add("Key1", "Value1"); profile.Dictionary.Add("Key2", "Value2"); profile.NestedObject = new TestNestedObject() { Strings = new List<string>() { "Address 1", "address 2" }, Test1 = "test", Test2 = null, Dictionary = new Dictionary<string, string>() { { "Key1", "Value1" }, { "Key2", "Value2" } }, ObjectHashSet = new HashSet<TestNestedObject2>() { new TestNestedObject2() { Test1 = "Test1", Test2 = 2 } } }; TestProfileClassExtended profile2 = new TestProfileClassExtended(); profile2.Name = "Richard"; profile2.Surname = "Benson"; profile2.NestedObject = new TestNestedObject() { Strings = new List<string>() { "Address 3", "address 4" }, Test1 = "test2", Test2 = 3, Dictionary = new Dictionary<string, string>() { { "Key3", "Value3" }, { "Key4", "Value4" } }, ObjectHashSet = new HashSet<TestNestedObject2>() { new TestNestedObject2() { Test1 = "Test1", Test2 = null } } }; profile2.Dictionary = new Dictionary<string, string>(); profile2.Dictionary.Add("Key3", "Value3"); profile2.Dictionary.Add("Key4", "Value4"); TestProfileClassExtended profile3 = new TestProfileClassExtended(); profile3.NestedObject = new TestNestedObject(); TestProfileClassExtended insertedDocument = _database .Insert(profile) .Run<TestProfileClassExtended>(); TestProfileClassExtended insertedDocument2 = _database .Insert(profile2) .Run<TestProfileClassExtended>(); TestProfileClassExtended insertedDocument3 = _database .Insert(profile3) .Run<TestProfileClassExtended>(); List<TestProfileClassExtended> documents = _database .Select() .From<TestProfileClassExtended>() .ToList<TestProfileClassExtended>(); Assert.True(documents.Count > 0); Assert.NotNull(documents[0].NestedObject); Assert.NotNull(documents[0].NestedObject.Strings); Assert.True(documents[0].NestedObject.Strings.Count > 0); Assert.NotNull(documents[0].NestedObject.Test1); Assert.Null(documents[0].NestedObject.Test2); Assert.True(documents[0].NestedObject.Dictionary.Keys.Count > 0); Assert.True(documents[0].Dictionary.Keys.Count > 0); Assert.True(documents[0].NestedObject.ObjectHashSet.Count > 0); Assert.NotNull(documents[0].NestedObject.ObjectHashSet.First().Test1); Assert.NotNull(documents[0].NestedObject.ObjectHashSet.First().Test2); Assert.NotNull(documents[1].NestedObject); Assert.NotNull(documents[1].NestedObject.Strings); Assert.True(documents[1].NestedObject.Strings.Count > 0); Assert.NotNull(documents[1].NestedObject.Test1); Assert.NotNull(documents[1].NestedObject.Test2); Assert.True(documents[1].NestedObject.Dictionary.Keys.Count > 0); Assert.True(documents[1].Dictionary.Keys.Count > 0); Assert.NotNull(documents[1].NestedObject.ObjectHashSet.First().Test1); Assert.Null(documents[1].NestedObject.ObjectHashSet.First().Test2); Assert.NotNull(documents[2].NestedObject); }
public void ShouldInsertObjectWithNestedObject() { // prerequisites _database .Create.Class <TestProfileClassExtended>() .Run(); TestProfileClassExtended profile = new TestProfileClassExtended(); profile.Name = "Johny"; profile.Surname = "Bravo"; profile.Dictionary = new Dictionary <string, string>(); profile.Dictionary.Add("Key1", "Value1"); profile.Dictionary.Add("Key2", "Value2"); profile.NestedObject = new TestNestedObject() { Strings = new List <string>() { "Address 1", "address 2" }, Test1 = "test", Test2 = null, Dictionary = new Dictionary <string, string>() { { "Key1", "Value1" }, { "Key2", "Value2" } }, ObjectHashSet = new HashSet <TestNestedObject2>() { new TestNestedObject2() { Test1 = "Test1", Test2 = 2 } } }; TestProfileClassExtended profile2 = new TestProfileClassExtended(); profile2.Name = "Richard"; profile2.Surname = "Benson"; profile2.NestedObject = new TestNestedObject() { Strings = new List <string>() { "Address 3", "address 4" }, Test1 = "test2", Test2 = 3, Dictionary = new Dictionary <string, string>() { { "Key3", "Value3" }, { "Key4", "Value4" } }, ObjectHashSet = new HashSet <TestNestedObject2>() { new TestNestedObject2() { Test1 = "Test1", Test2 = null } } }; profile2.Dictionary = new Dictionary <string, string>(); profile2.Dictionary.Add("Key3", "Value3"); profile2.Dictionary.Add("Key4", "Value4"); TestProfileClassExtended profile3 = new TestProfileClassExtended(); profile3.NestedObject = new TestNestedObject(); TestProfileClassExtended insertedDocument = _database .Insert(profile) .Run <TestProfileClassExtended>(); TestProfileClassExtended insertedDocument2 = _database .Insert(profile2) .Run <TestProfileClassExtended>(); TestProfileClassExtended insertedDocument3 = _database .Insert(profile3) .Run <TestProfileClassExtended>(); List <TestProfileClassExtended> documents = _database .Select() .From <TestProfileClassExtended>() .ToList <TestProfileClassExtended>(); Assert.True(documents.Count > 0); Assert.NotNull(documents[0].NestedObject); Assert.NotNull(documents[0].NestedObject.Strings); Assert.True(documents[0].NestedObject.Strings.Count > 0); Assert.NotNull(documents[0].NestedObject.Test1); Assert.Null(documents[0].NestedObject.Test2); Assert.True(documents[0].NestedObject.Dictionary.Keys.Count > 0); Assert.True(documents[0].Dictionary.Keys.Count > 0); Assert.True(documents[0].NestedObject.ObjectHashSet.Count > 0); Assert.NotNull(documents[0].NestedObject.ObjectHashSet.First().Test1); Assert.NotNull(documents[0].NestedObject.ObjectHashSet.First().Test2); Assert.NotNull(documents[1].NestedObject); Assert.NotNull(documents[1].NestedObject.Strings); Assert.True(documents[1].NestedObject.Strings.Count > 0); Assert.NotNull(documents[1].NestedObject.Test1); Assert.NotNull(documents[1].NestedObject.Test2); Assert.True(documents[1].NestedObject.Dictionary.Keys.Count > 0); Assert.True(documents[1].Dictionary.Keys.Count > 0); Assert.NotNull(documents[1].NestedObject.ObjectHashSet.First().Test1); Assert.Null(documents[1].NestedObject.ObjectHashSet.First().Test2); Assert.NotNull(documents[2].NestedObject); }