public void GivenAServiceOffering_AndInitializeFromTemplate_WhenWrite_ThenFileSavedWithExpectedContentType() { string expectedContentType = ExcelWriter.ContentType; var offering = TestData.ServiceOfferings[0]; var fileName = string.Format("{0}-{1}-{2}{3}", offering.Provider.Name, offering.ServiceType.Name, DateTime.Now.Ticks, ".xlsx"); var downloadfilePath = string.Format("{0}{1}", AssignedServiceOfferingTemplatePath.Replace("\\App_Data\\Uploads\\Templates\\" + ServiceOfferingController.TemplateFile, "\\Content\\Downloads\\"), fileName); WorksheetWriter writer = new WorksheetWriter(offering, ServiceOfferingSheetName); IBlobContainer mockBlobContainer = MockRepository.GenerateMock <IBlobContainer>(); Target.InitializeFrom(AssignedServiceOfferingTemplatePath, writer); Target.Write(mockBlobContainer, downloadfilePath); mockBlobContainer.AssertWasCalled(m => m.UploadFromStream(downloadfilePath, Target.FileContentStream, expectedContentType)); }