public void If_LargeComplexObjectStored_ThenRetrievedOk() { var longList = GetLargeListOfStrings(); // ARRANGE // ACT and // ASSERT bool startedOk; using (var executionContext = CreateTaskExecutionContext()) { startedOk = executionContext.TryStart(); Assert.AreEqual(true, startedOk); if (startedOk) { var myObject = new MyComplexClass() { Id = 10, Name = "Rupert", DateOfBirth = new DateTime(1955, 1, 1), SomeOtherData = new MyOtherComplexClass() { Value = 12.6m, Notes = longList } }; var block = executionContext.GetObjectBlocks <MyComplexClass>(x => x.WithObject(myObject)).First(); Assert.AreEqual(myObject.Id, block.Block.Object.Id); Assert.AreEqual(myObject.Name, block.Block.Object.Name); Assert.AreEqual(myObject.DateOfBirth, block.Block.Object.DateOfBirth); Assert.AreEqual(myObject.SomeOtherData.Value, block.Block.Object.SomeOtherData.Value); Assert.AreEqual(myObject.SomeOtherData.Notes.Count, block.Block.Object.SomeOtherData.Notes.Count); for (int i = 0; i < myObject.SomeOtherData.Notes.Count; i++) { Assert.AreEqual(myObject.SomeOtherData.Notes[i], block.Block.Object.SomeOtherData.Notes[i]); } } } }
public void If_ComplexObjectStored_ThenRetrievedOk() { // ARRANGE // ACT and // ASSERT bool startedOk; using (var executionContext = CreateTaskExecutionContext()) { startedOk = executionContext.TryStart(); Assert.AreEqual(true, startedOk); if (startedOk) { var myObject = new MyComplexClass() { Id = 10, Name = "Rupert", DateOfBirth = new DateTime(1955, 1, 1), SomeOtherData = new MyOtherComplexClass() { Value = 12.6m, Notes = new List <string>() { "hello", "goodbye", null } } }; var block = executionContext.GetObjectBlocks <MyComplexClass>(x => x.WithObject(myObject)).First(); Assert.AreEqual(myObject.Id, block.Block.Object.Id); Assert.AreEqual(myObject.Name, block.Block.Object.Name); Assert.AreEqual(myObject.DateOfBirth, block.Block.Object.DateOfBirth); Assert.AreEqual(myObject.SomeOtherData.Value, block.Block.Object.SomeOtherData.Value); Assert.AreEqual(myObject.SomeOtherData.Notes[0], block.Block.Object.SomeOtherData.Notes[0]); Assert.AreEqual(myObject.SomeOtherData.Notes[1], block.Block.Object.SomeOtherData.Notes[1]); Assert.IsNull(block.Block.Object.SomeOtherData.Notes[2]); } } }
public void If_ComplexObjectStored_ThenRetrievedOk() { // ARRANGE // ACT and // ASSERT bool startedOk; using (var executionContext = CreateTaskExecutionContext()) { startedOk = executionContext.TryStart(); Assert.AreEqual(true, startedOk); if (startedOk) { var myObject = new MyComplexClass() { Id = 10, Name = "Rupert", DateOfBirth = new DateTime(1955, 1, 1), SomeOtherData = new MyOtherComplexClass() { Value = 12.6m, Notes = new List<string>() { "hello", "goodbye", null } } }; var block = executionContext.GetObjectBlocks<MyComplexClass>(x => x.WithObject(myObject)).First(); Assert.AreEqual(myObject.Id, block.Block.Object.Id); Assert.AreEqual(myObject.Name, block.Block.Object.Name); Assert.AreEqual(myObject.DateOfBirth, block.Block.Object.DateOfBirth); Assert.AreEqual(myObject.SomeOtherData.Value, block.Block.Object.SomeOtherData.Value); Assert.AreEqual(myObject.SomeOtherData.Notes[0], block.Block.Object.SomeOtherData.Notes[0]); Assert.AreEqual(myObject.SomeOtherData.Notes[1], block.Block.Object.SomeOtherData.Notes[1]); Assert.IsNull(block.Block.Object.SomeOtherData.Notes[2]); } } }
public void If_LargeComplexObjectStored_ThenRetrievedOk() { var longList = GetLargeListOfStrings(); // ARRANGE // ACT and // ASSERT bool startedOk; using (var executionContext = CreateTaskExecutionContext()) { startedOk = executionContext.TryStart(); Assert.AreEqual(true, startedOk); if (startedOk) { var myObject = new MyComplexClass() { Id = 10, Name = "Rupert", DateOfBirth = new DateTime(1955, 1, 1), SomeOtherData = new MyOtherComplexClass() { Value = 12.6m, Notes = longList } }; var block = executionContext.GetObjectBlocks<MyComplexClass>(x => x.WithObject(myObject)).First(); Assert.AreEqual(myObject.Id, block.Block.Object.Id); Assert.AreEqual(myObject.Name, block.Block.Object.Name); Assert.AreEqual(myObject.DateOfBirth, block.Block.Object.DateOfBirth); Assert.AreEqual(myObject.SomeOtherData.Value, block.Block.Object.SomeOtherData.Value); Assert.AreEqual(myObject.SomeOtherData.Notes.Count, block.Block.Object.SomeOtherData.Notes.Count); for (int i = 0; i < myObject.SomeOtherData.Notes.Count; i++) { Assert.AreEqual(myObject.SomeOtherData.Notes[i], block.Block.Object.SomeOtherData.Notes[i]); } } } }