Hi gliz
1st i want to complain cause nobody fixed my notification problem yet
2nd) look at the method bellow
public static void GetFileMediaValue(FileField fileField,EcmsLogOnContext ecmsLogOnContext, EcmsListItem listItem)
{
HttpPostedFile postedFile = fileField.PostedFile;
if (postedFile != null && postedFile.ContentLength > 0)
{
int fileLength = postedFile.ContentLength;
var mem = new byte[fileLength];
Stream postedStream = postedFile.InputStream;
postedStream.Read(mem, 0, fileLength);
EcmsFileManager.GetAnInstance(ecmsLogOnContext).AssignFile(listItem, (EcmsFieldFile) fileField.Field,
mem, postedFile.ContentType, fileField.FileName);
}
}
and here is th test method
[Test]
public void GetFileMediaValue()
{
EcmsListItemMockHelper.ConstractorMock();
var ecmsListItem = new EcmsListItem(Guid.Empty, Guid.Empty, 0, null);
var context = new EcmsLogOnContext();
var ecmsFieldFile = new EcmsFieldFile();
var fileField=new FileField(ecmsFieldFile);
fileField.PostedFile=new HttpPostedFile();
using (RecordExpectations expectations = RecorderManager.StartRecording())
{
EcmsFileManager.GetAnInstance(context).AssignFile(ecmsListItem, ecmsFieldFile, null,
fileField.PostedFile.ContentType, fileField.FileName);
expectations.IgnoreArguments();
}
BaseFieldControlExtensions.GetFileMediaValue(fileField, context, ecmsListItem);
}
but the line
fileField.PostedFile=new HttpPostedFile();
cannot be compiled of course