예제 #1
0
        public void InitializeTest()
        {
            EducationContext = new EducationDataContext();
            Container        = AssemblySetup.CreateWindsorContainer(EducationContext);
            User             = new EducationSecurityPrincipal(EducationContext.Users.Include("UserRoles.Role").Include(u => u.PrivateHealthDataViewEvents).Single(u => u.Id == 1));
            RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext);

            Target = new PublicFieldManager(repositoryContainer, MockRepository.GenerateMock <IBlobClient>(), new DataTableBinder(), new UserAuditor());
        }
 public void InitializeTest()
 {
     IBlobClient mockBlobClient = MockRepository.GenerateMock<IBlobClient>();
     IBlobContainer mockBlobContainer = MockRepository.GenerateMock<IBlobContainer>();
     mockBlobContainer.Expect(m => m.DownloadToStream(null, null)).IgnoreArguments().Do(new Action<string, Stream>((address, target) =>
     {
         byte[] byteArray = File.ReadAllBytes(address);
         target.Write(byteArray, 0, (int)byteArray.Length);
     }));
     mockBlobContainer.Expect(m => m.UploadFromStream(null, null)).IgnoreArguments().Do(new Action<string, Stream>((address, stream) =>
     {
         File.WriteAllBytes(address, ((MemoryStream)stream).ToArray());
     }));
     mockBlobClient.Expect(m => m.CreateContainer(null)).IgnoreArguments().Return(mockBlobContainer);
     MockUserAuditor = MockRepository.GenerateMock<IUserAuditor>();
     Target = new PublicFieldManager(Repositories.MockRepositoryContainer, mockBlobClient, MockDataTableBinder, MockUserAuditor);
     ExportFileFactory.SetCurrent(MockRepository.GenerateMock<IExportFileFactory>());
 }
 public void InitializeTest()
 {
     EducationContext = new EducationDataContext();
     Container = AssemblySetup.CreateWindsorContainer(EducationContext);
     User = new EducationSecurityPrincipal(EducationContext.Users.Include("UserRoles.Role").Include(u => u.PrivateHealthDataViewEvents).Single(u => u.Id == 1));
     RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext);
     Target = new PublicFieldManager(repositoryContainer, MockRepository.GenerateMock<IBlobClient>(), new DataTableBinder(), new UserAuditor());
 }