public void ReadOnly() { var set = new SetTest(); for (int x = 0, m = RandomInt(byte.MaxValue) * 2; x < m; x++) { set.Set.Add(RandomInt()); set.Dictionary.Add(RandomInt(), RandomString(RandomInt(byte.MaxValue))); } var original = new ReadOnlyDummyClass(set); // Check that is the same var retInside = _serializer.Serialize(original.Test); var ret = _serializer.Serialize(original); CollectionAssert.AreEqual(ret, retInside); // Test deserialization var clone = _serializer.Deserialize <ReadOnlyDummyClass>(ret); Assert.AreEqual(set.Set.Count, clone.Test.Set.Count); Assert.AreEqual(set.Dictionary.Count, clone.Test.Dictionary.Count); CollectionAssert.AreEqual(set.Set.ToArray(), clone.Test.Set.ToArray()); CollectionAssert.AreEqual(set.Dictionary.Keys.ToArray(), clone.Test.Dictionary.Keys.ToArray()); CollectionAssert.AreEqual(set.Dictionary.Values.ToArray(), clone.Test.Dictionary.Values.ToArray()); }
public void Set(SerializableTest wrapper) { SetTest test = wrapper.Test.Set; Check(test.IsError, test.Request, batch => { DocumentReference doc = GetDocumentReference(test.DocRefPath); object documentData = DeserializeJson(test.JsonData); var setOptions = test.Option == null ? null : test.Option.All ? SetOptions.MergeAll : SetOptions.MergeFields(test.Option.Fields.Select(ConvertFieldPath).ToArray()); batch.Set(doc, documentData, setOptions); }); }
public void Serialize_Sets() { var set = new SetTest(); for (int x = 0, m = RandomInt(byte.MaxValue) * 2; x < m; x++) { set.Set.Add(RandomInt()); set.Dictionary.Add(RandomInt(), RandomString(RandomInt(ushort.MaxValue))); } var ret = _serializer.Serialize(set); var clone = _serializer.Deserialize <SetTest>(ret); Assert.AreEqual(set.Set.Count, clone.Set.Count); Assert.AreEqual(set.Dictionary.Count, clone.Dictionary.Count); CollectionAssert.AreEqual(set.Set.ToArray(), clone.Set.ToArray()); CollectionAssert.AreEqual(set.Dictionary.Keys.ToArray(), clone.Dictionary.Keys.ToArray()); CollectionAssert.AreEqual(set.Dictionary.Values.ToArray(), clone.Dictionary.Values.ToArray()); }
static void Main(string[] args) { Space("INTERFACE"); var all = new All(); var consume = new Consume(all, all); consume.Bar(); consume.Foo(); Space("ABSTRACT"); var abst = new AbstractImp(); abst.Bar(); abst.Foo(); Space("VIRTUAL"); var virBase = new VirtualBase(); var virImp = new VirtualImp(); virBase.Bar(); virBase.Foo(); virImp.Bar(); virImp.Foo(); Space("SET"); var setTest = new SetTest(3, 1, 2, 2); setTest.Print(); Space("FIBIONACCI 1"); for (int i = 0; i < 5; i++) { Console.WriteLine(FibonacciSeries(i)); } Space("FIBIONACCI 2"); FibonacciRecursive(); Console.WriteLine(""); FibonacciRecursive(3, 5, 7, 10); Console.WriteLine(""); }
public ReadOnlyDummyClass(SetTest test) { Test = test; }