Ejemplo n.º 1
0
		public void DeserializeWarningTest()
		{
			CommandResultBase target = CreateCommandResultBase(); 
			ArrayList values = new ArrayList();
			IBinaryReader reader = new ArrayListReaderMock(values);
			values.Add("test warning text");

			target.DeserializeWarning(reader);

			CollectionAssert.AreEqual(target.Warnings, values);
		}
		public void DeserializeTest()
		{
			BuildExcerptsCommandResult target = new BuildExcerptsCommandResult();
			ArrayList list = new ArrayList();
			ArrayListReaderMock reader = new ArrayListReaderMock(list);
			list.Add("test1");
			list.Add("test2");

			target.Deserialize(reader, list.Count);

			CollectionAssert.AreEqual(target.Excerpts, list);
		}
		public void DeserializeResponseTest()
		{
			using (ConnectionMock connection = new ConnectionMock("test"))
			{
				bool deserializeCalled = false;
				BuildExcerptsCommand target = new BuildExcerptsCommand(connection);
				var accessor = GetCommandAccessor(target);
				IBinaryReader arrayReader = new ArrayListReaderMock(new ArrayList());
				accessor.Result = new MBuildExcerptsCommandResult
              	{
              		DeserializeIBinaryReaderInt32 = (reader, count) => { deserializeCalled = (reader == arrayReader && count == 1); }
              	};
				target.Documents.Add("test");

				accessor.DeserializeResponse(arrayReader);

				Assert.IsTrue(deserializeCalled);
			}
		}