public void GivenXelement_DropBox_ShouldHaveContructorAndDefaultValuiesSet() { const string conStr = @"<Source ID=""2aa3fdba-e0c3-47dd-8dd5-e6f24aaf5c7a"" Name=""test server"" Type=""Dev2Server"" ConnectionString=""AppServerUri=http://178.63.172.163:3142/dsf;WebServerPort=3142;AuthenticationType=Public;UserName=;Password="" Version=""1.0"" ResourceType=""Server"" ServerID=""51a58300-7e9d-4927-a57b-e5d700b11b55""> <TypeOf>Dev2Server</TypeOf> <DisplayName>test server</DisplayName> <Category>WAREWOLF SERVERS</Category> <Signature xmlns=""http://www.w3.org/2000/09/xmldsig#""> <SignedInfo> <CanonicalizationMethod Algorithm=""http://www.w3.org/TR/2001/REC-xml-c14n-20010315"" /> <SignatureMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#rsa-sha1"" /> <Reference URI=""""> <Transforms> <Transform Algorithm=""http://www.w3.org/2000/09/xmldsig#enveloped-signature"" /> </Transforms> <DigestMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#sha1"" /> <DigestValue>1ia51dqx+BIMQ4QgLt+DuKtTBUk=</DigestValue> </Reference> </SignedInfo> <SignatureValue>Wqd39EqkFE66XVETuuAqZveoTk3JiWtAk8m1m4QykeqY4/xQmdqRRSaEfYBr7EHsycI3STuILCjsz4OZgYQ2QL41jorbwULO3NxAEhu4nrb2EolpoNSJkahfL/N9X5CvLNwpburD4/bPMG2jYegVublIxE50yF6ZZWG5XiB6SF8=</SignatureValue> </Signature> </Source>"; var element = XElement.Parse(conStr); OauthSource oauthSource = new DropBoxSource(element); Assert.IsNotNull(oauthSource); var xElement = oauthSource.ToXml(); Assert.IsNotNull(xElement); }
public void OauthSource_ToXml_ShouldContructorAndDefaultValuiesSet() { OauthSource oauthSource = new DropBoxSource(); Assert.IsNotNull(oauthSource); var xElement = oauthSource.ToXml(); Assert.IsNotNull(xElement); }
public void DropBoxSource_ToXmlEmptyObject_XElementWithNoInformation_AreEqual_ExpectTrue() { var testDropBoxSource = new DropBoxSource(); var expectedXml = testDropBoxSource.ToXml(); var attrib = expectedXml.Attributes(); var attribEnum = attrib.GetEnumerator(); while (attribEnum.MoveNext()) { if (attribEnum.Current.Name == "Name") { Assert.AreEqual(string.Empty, attribEnum.Current.Value); break; } } }
public void ToXmlEmptyObjectExpectedXElementContainingNoInformationRegardingSource() { var testDropBoxSource = new DropBoxSource(); XElement expectedXml = testDropBoxSource.ToXml(); IEnumerable <XAttribute> attrib = expectedXml.Attributes(); IEnumerator <XAttribute> attribEnum = attrib.GetEnumerator(); while (attribEnum.MoveNext()) { if (attribEnum.Current.Name == "Name") { Assert.AreEqual(string.Empty, attribEnum.Current.Value); break; } } }
public void OauthSource_ToXML_Construct_ExpectPropertiesSet() { //------------Setup for test-------------------------- var oauthSource = new DropBoxSource() { AppKey = "key", AccessToken = "secret" }; //------------Execute Test--------------------------- var outxml = oauthSource.ToXml(); //------------Assert Results------------------------- var readOauthSource = new DropBoxSource(outxml) { AppKey = "key", AccessToken = "secret" }; var conStringAttr = outxml.Attribute("ConnectionString"); Assert.IsNotNull(conStringAttr); Assert.IsTrue(conStringAttr.Value.IsBase64()); }