public void MSOXWSCONT_S07_TC01_SetUserPhotoSuccess()
{
Site.Assume.IsTrue(Common.IsRequirementEnabled(1275114, this.Site), "Implementation does not support the SetUserPhoto operation.");
#region Step 1: Call SetUserPhoto operation to set a photo to specific user.
string emailAddress = string.Format("{0}@{1}", Common.GetConfigurationPropertyValue("ContactUserName", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site));
SetUserPhotoType setUserPhotoRequest = new SetUserPhotoType();
setUserPhotoRequest.Email = emailAddress;
using (FileStream imageStream = new FileStream("UserPhoto.jpg", FileMode.Open, FileAccess.ReadWrite))
{
byte[] buffer = new byte[imageStream.Length];
imageStream.Read(buffer, 0, (int)imageStream.Length);
string imagContent = System.Convert.ToBase64String(buffer);
setUserPhotoRequest.Content = imagContent;
}
SetUserPhotoResponseMessageType setUserPhotoResponse = this.CONTAdapter.SetUserPhoto(setUserPhotoRequest);
Site.Assert.IsNotNull(setUserPhotoResponse, "SetUserPhoto operation success.");
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R302081");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R302081
this.Site.CaptureRequirementIfIsNotNull(
setUserPhotoResponse,
302081,
@"[In SetUserPhoto] [The protocol client sends a SetUserPhotoSoapIn request WSDL message] and the protocol server responds with a SetUserPhotoSoapOut response WSDL message");
#endregion
#region Step 2: Call GetUserPhoto operation to get the photo which is set by step above.
GetUserPhotoType getUserPhotoRequest = new GetUserPhotoType();
getUserPhotoRequest.Email = emailAddress;
getUserPhotoRequest.SizeRequested = UserPhotoSizeType.HR96x96;
GetUserPhotoResponseMessageType getUserPhotoResponse = this.CONTAdapter.GetUserPhoto(getUserPhotoRequest);
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R302024");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R302024
this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
ResponseClassType.Success,
getUserPhotoResponse.ResponseClass,
302024,
@"[In GetUserPhotoSoapOut] A successful GetUserPhoto WSDL operation request returns a GetUserPhotoResponse element with the ResponseClass attribute set to ""Success"".");
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R302025");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R302025
this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
ResponseCodeType.NoError,
getUserPhotoResponse.ResponseCode,
302025,
@"[In GetUserPhotoSoapOut] [A successful GetUserPhoto WSDL operation request returns a GetUserPhotoResponse element ] The ResponseCode element of the GetUserPhotoResponse element is set to ""No Error"".");
#endregion
}