/// <summary>Assert is equal.</summary> /// <param name="actual"> The actual.</param> /// <param name="expected">The expected.</param> public static void AssertIsEqual(ModelWithComplexTypes actual, ModelWithComplexTypes expected) { Assert.That(actual.Id, Is.EqualTo(expected.Id)); Assert.That(actual.StringList, Is.EquivalentTo(expected.StringList)); Assert.That(actual.IntList, Is.EquivalentTo(expected.IntList)); Assert.That(actual.StringMap, Is.EquivalentTo(expected.StringMap)); Assert.That(actual.IntMap, Is.EquivalentTo(expected.IntMap)); if (expected.Child == null) { Assert.That(actual.Child, Is.Null); return; } Assert.That(actual.Child, Is.Not.Null); ModelWithComplexTypes.AssertIsEqual(actual.Child, expected.Child); }
/// <summary>Assert is equal.</summary> /// <param name="actual"> The actual.</param> /// <param name="expected">The expected.</param> public static void AssertIsEqual(ModelWithComplexTypes actual, ModelWithComplexTypes expected) { Assert.That(actual.Id, Is.EqualTo(expected.Id)); Assert.That(actual.StringList, Is.EquivalentTo(expected.StringList)); Assert.That(actual.IntList, Is.EquivalentTo(expected.IntList)); Assert.That(actual.StringMap, Is.EquivalentTo(expected.StringMap)); Assert.That(actual.IntMap, Is.EquivalentTo(expected.IntMap)); if (expected.Child == null) { Assert.That(actual.Child, Is.Null); } else { Assert.That(actual.Child, Is.Not.Null); AssertIsEqual(actual.Child, expected.Child); } }
/// <summary>Creates a new ModelWithComplexTypes.</summary> /// <param name="id">The identifier.</param> /// <returns>The ModelWithComplexTypes.</returns> public static ModelWithComplexTypes Create(int id) { var row = new ModelWithComplexTypes { Id = id, StringList = { "val" + id + 1, "val" + id + 2, "val" + id + 3 }, IntList = { id + 1, id + 2, id + 3 }, StringMap = { {"key" + id + 1, "val" + id + 1}, {"key" + id + 2, "val" + id + 2}, {"key" + id + 3, "val" + id + 3}, }, IntMap = { {id + 1, id + 2}, {id + 3, id + 4}, {id + 5, id + 6}, }, Child = new ModelWithComplexTypes { Id = id * 2 }, }; return row; }
/// <summary>Creates a new ModelWithComplexTypes.</summary> /// <param name="id">The identifier.</param> /// <returns>The ModelWithComplexTypes.</returns> public static ModelWithComplexTypes Create(int id) { ModelWithComplexTypes modelWithComplexType1 = new ModelWithComplexTypes(); modelWithComplexType1.Id = (long)id; modelWithComplexType1.StringList.Add(string.Concat("val", id, 1)); modelWithComplexType1.StringList.Add(string.Concat("val", id, 2)); modelWithComplexType1.StringList.Add(string.Concat("val", id, 3)); modelWithComplexType1.IntList.Add(id + 1); modelWithComplexType1.IntList.Add(id + 2); modelWithComplexType1.IntList.Add(id + 3); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 1), string.Concat("val", id, 1)); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 2), string.Concat("val", id, 2)); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 3), string.Concat("val", id, 3)); modelWithComplexType1.IntMap.Add(id + 1, id + 2); modelWithComplexType1.IntMap.Add(id + 3, id + 4); modelWithComplexType1.IntMap.Add(id + 5, id + 6); modelWithComplexType1.Child = new ModelWithComplexTypes() { Id = (long)(id * 2), }; return(modelWithComplexType1); }
/// <summary>Creates a new ModelWithComplexTypes.</summary> /// <param name="id">The identifier.</param> /// <returns>The ModelWithComplexTypes.</returns> public static ModelWithComplexTypes Create(int id) { ModelWithComplexTypes modelWithComplexType1 = new ModelWithComplexTypes(); modelWithComplexType1.Id = (long)id; modelWithComplexType1.StringList.Add(string.Concat("val", id, 1)); modelWithComplexType1.StringList.Add(string.Concat("val", id, 2)); modelWithComplexType1.StringList.Add(string.Concat("val", id, 3)); modelWithComplexType1.IntList.Add(id + 1); modelWithComplexType1.IntList.Add(id + 2); modelWithComplexType1.IntList.Add(id + 3); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 1), string.Concat("val", id, 1)); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 2), string.Concat("val", id, 2)); modelWithComplexType1.StringMap.Add(string.Concat("key", id, 3), string.Concat("val", id, 3)); modelWithComplexType1.IntMap.Add(id + 1, id + 2); modelWithComplexType1.IntMap.Add(id + 3, id + 4); modelWithComplexType1.IntMap.Add(id + 5, id + 6); modelWithComplexType1.Child = new ModelWithComplexTypes(){ Id= (long)(id*2), }; return modelWithComplexType1; }
/// <summary>Creates a constant.</summary> /// <param name="i">Zero-based index of the.</param> /// <returns>The new constant.</returns> public static ModelWithComplexTypes CreateConstant(int i) { return(ModelWithComplexTypes.Create(i)); }