1
/* Copyright (c) 2006 Google Inc.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
20
using NUnit.Framework;
21
using Google.GData.Client;
22
using Google.GData.Extensions;
24
namespace Google.GData.Spreadsheets.UnitTests
27
[Category("GoogleSpreadsheets")]
28
public class CellEntryTest
30
private CellEntry entry;
31
private CellEntry.CellElement cell;
37
entry = new CellEntry();
38
cell = new CellEntry.CellElement();
49
public void GetCellTest()
51
Assert.IsNotNull(entry.Cell);
55
public void SetCellTest()
58
Assert.AreEqual(cell, entry.Cell);
62
public void SaveAndReadTest()
64
StringBuilder sb = new StringBuilder();
65
XmlWriter writer = new XmlTextWriter(new StringWriter(sb));
66
uint row = (uint)rng.Next();
68
uint column = (uint)rng.Next();
70
cell.InputValue = "input string";
71
cell.NumericValue = "numeric value";
72
cell.Value = "display value";
76
XmlDocument document = new XmlDocument();
77
document.LoadXml(sb.ToString());
79
ExtensionElementEventArgs e = new ExtensionElementEventArgs();
80
e.ExtensionElement = document.FirstChild;
82
entry.Parse(e, new AtomFeedParser());
84
Assert.AreEqual(row, entry.Cell.Row, "Rows should be equal");
85
Assert.AreEqual(column, entry.Cell.Column, "Columns should be equal");
86
Assert.AreEqual("input string", entry.Cell.InputValue, "Input value should be equal");
87
Assert.AreEqual("numeric value", entry.Cell.NumericValue, "Numeric value should be equal");
88
Assert.AreEqual("display value", entry.Cell.Value, "Cell value should be equal");