Exemplo n.º 1
0
        static unsafe void Main(string[] args)
        {
            Span <byte> s;

            //var x = File.OpenWrite("b.dll");
            //AheadOfTimeActivator.WriteImplementation<TestClass>(x);
            //var y = File.OpenWrite("a.dll");
            //AheadOfTimeActivator.WriteImplementation<TestClass2>(y);
            //x.Flush();
            //y.Flush();
            //var user32 = LibraryActivator.CreateInstance<TestClass>("user32.dll");
            //user32.MessageBox(IntPtr.Zero, "SuperInvoke".ToCharArray(), "Hello from SuperInvoke!".ToCharArray(), 0);
            if (AotTest)
            {
                var libBuilder = new LibraryBuilder();
                var opts       = BuilderOptions.GetDefault(typeof(TestClass2));
                libBuilder.Add(opts);
#if NET47
                var bytes = libBuilder.BuildBytes();
                File.WriteAllBytes("c.dll", bytes);
#else
                libBuilder.Build();
#endif
            }

            var lib = LibraryActivator.CreateInstance <TestClass2>("user32");

            var a = Marshal.StringToHGlobalAnsi("Test 1");
            var b = Marshal.StringToHGlobalAnsi("Hello from SuperInvoke!");
            lib.MessageBox(default, (char *)a, (char *)b, 0);
 public async Task Setup()
 {
     _library  = LibraryBuilder.Build();
     _account  = AccountBuilder.InLibrary(_library.Id).AsInvitation().Build();
     _response = await Client.PostObject($"/accounts/invitations", new ResendInvitationCodeRequest()
     {
         Email = _account.Email
     });
 }
Exemplo n.º 3
0
        public static byte[] BuildBytes(this LibraryBuilder builder)
        {
            var asm = ((AssemblyBuilder)builder.Build());

            asm.Save(builder.Name + ".dll");
            var bytes = File.ReadAllBytes(builder.Name + ".dll");

            File.Delete(builder.Name + ".dll");
            return(bytes);
        }
        public void SetUp()
        {
            var context = new TestContext(x => { x.AddFixture <FixtureWithHiddenGrammarsFixture>(); });

            var observer = MockRepository.GenerateMock <IFixtureObserver>();
            var builder  = new LibraryBuilder(observer, new CompositeFilter <Type>());

            builder.Build(context);

            library = builder.Library;
        }
Exemplo n.º 5
0
        public async Task Setup()
        {
            _library = LibraryBuilder.Build();

            _response = await Client.PostObject($"/accounts/invite",
                                                new InviteUserRequest
            {
                Name  = _name,
                Email = _email,
                Role  = Role.Admin
            });
        }
Exemplo n.º 6
0
 static async Task Main(string[] args)
 {
     try
     {
         var builder = new LibraryBuilder();
         await builder.Build("/usr/share/dict/words", "/Users/mark/words.index2");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
        public void SetUp()
        {
            observer = MockRepository.GenerateMock <IFixtureObserver>();
            var filter = new CompositeFilter <Type>();

            filter.Includes += t => t.Name.StartsWith("M");


            builder = new LibraryBuilder(observer, filter);

            library = builder.Build(new TestContext(x => x.AddFixturesFromThisAssembly()));
        }
        public void SetUp()
        {
            var builder  = new LibraryBuilder(new NulloFixtureObserver(), new CompositeFilter <Type>());
            var registry = new FixtureRegistry();

            registry.AddFixturesFromAssemblyContaining <SetUserAction>();

            var container = registry.BuildContainer();
            var context   = new TestContext(container);


            library = builder.Build(context);
        }
Exemplo n.º 9
0
        public async Task Setup()
        {
            _library = LibraryBuilder.Build();
            _account = AccountBuilder.InLibrary(_library.Id).AsInvitation().Build();

            _response = await Client.PostObject($"/accounts/register/{_account.InvitationCode}",
                                                new RegisterRequest
            {
                Name        = _name,
                Password    = _password,
                AcceptTerms = true
            });
        }
Exemplo n.º 10
0
        public async Task Setup()
        {
            var library = LibraryBuilder.Build();
            var account = AccountBuilder.As(Domain.Models.Role.Admin).Verified().InLibrary(library.Id).Build();

            _authResponse = await AccountBuilder.Authenticate(Client, account.Email);

            AuthenticateClientWithToken(_authResponse.JwtToken);

            _response = await Client.PostObject("/accounts/refresh-token", new RefreshTokenRequest { RefreshToken = _authResponse.RefreshToken });

            _refreshResponse = await _response.GetContent <AuthenticateResponse>();
        }
Exemplo n.º 11
0
        public async Task Setup()
        {
            var library = LibraryBuilder.Build();
            var account = AccountBuilder.As(Role.Reader)
                          .InLibrary(library.Id)
                          .Verified()
                          .Build();

            _response = await Client.PostObject($"/accounts/invite/library/{library.Id}",
                                                new InviteUserRequest
            {
                Email = account.Email,
                Role  = Role.Reader
            });
        }
Exemplo n.º 12
0
        private void fixturesShouldBe(params string[] names)
        {
            var builder = new LibraryBuilder(new NulloFixtureObserver(), project.CurrentFixtureFilter().CreateTypeFilter());
            var library = builder.Build(new TestContext(x =>
            {
                x.AddFixture <OhioFixture>();
                x.AddFixture <WisconsinFixture>();
                x.AddFixture <IllinoisFixture>();
                x.AddFixture <NorthFixture>();
                x.AddFixture <SouthFixture>();
            }));

            Array.Sort(names);

            library.ActiveFixtures.Select(x => x.Name).ShouldHaveTheSameElementsAs(names);
        }
Exemplo n.º 13
0
        public async Task Setup()
        {
            var name     = RandomData.String;
            var password = RandomData.String;

            _library = LibraryBuilder.Build();
            _account = AccountBuilder.InLibrary(_library.Id).AsInvitation().Build();

            _response = await Client.PostObject($"/accounts/register/{Guid.NewGuid().ToString("N")}",
                                                new RegisterRequest
            {
                Name        = name,
                Password    = password,
                AcceptTerms = true
            });
        }
Exemplo n.º 14
0
        public async Task Setup()
        {
            var name     = RandomData.String;
            var password = RandomData.String;

            _library = LibraryBuilder.Build();
            _account = AccountBuilder.InLibrary(_library.Id)
                       .AsInvitation().ExpiringInvitation(DateTime.UtcNow.AddDays(-1)).Build();

            _response = await Client.PostObject($"/accounts/register/{_account.InvitationCode}",
                                                new RegisterRequest
            {
                Name        = name,
                Password    = password,
                AcceptTerms = true
            });
        }
Exemplo n.º 15
0
        public async Task Setup()
        {
            _library1 = LibraryBuilder.Build();
            _account  = AccountBuilder.As(Role.Reader)
                        .InLibrary(_library1.Id)
                        .Verified()
                        .Build();

            _library2 = LibraryBuilder.Build();

            _response = await Client.PostObject($"/accounts/invite/library/{_library2.Id}",
                                                new InviteUserRequest
            {
                Email = _account.Email,
                Role  = Role.LibraryAdmin
            });
        }
Exemplo n.º 16
0
        public Optional <ProjectBuild> TryBuild(BuildProject args, Log logger)
        {
            try
            {
                var project = _simulatorBuilder.CreateSimulatorProject(args);

                var libraryBuilder = new LibraryBuilder(new Disk(logger), BuildTargets.Package)
                {
                    Express = true
                };
                var projectBuilder = new ProjectBuilder(logger, new LocalSimulatorTarget(), project.Options);

                if (project.IsVerboseBuild)
                {
                    logger.Level = Uno.Logging.LogLevel.Verbose;
                }

                if (project.BuildLibraries)
                {
                    libraryBuilder.Build();
                }

                var buildResult = projectBuilder.Build(project.Project);

                if (buildResult.ErrorCount != 0)
                {
                    return(Optional.None());
                }

                var b = new LocalBuild(buildResult, AbsoluteFilePath.Parse(args.ProjectPath));
                return(new ProjectBuild(b.Path.NativePath, b.SaveSimulatorMetadata(_fileSystem).NativePath, b.GetTypeInformation()));
            }
            catch (ThreadAbortException)
            {
            }
            catch (SourceException e)
            {
                logger.Error(e.Source, null, e.Message);
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
            }
            return(Optional.None());
        }
Exemplo n.º 17
0
        public override void Execute(IEnumerable <string> args)
        {
            var force = false;
            var lib   = new LibraryBuilder(Log);

            lib.RebuildList = new OptionSet {
                { "a|all", value => lib.RebuildAll = true },
                { "f|force", value => force = true },
                { "x|e|express", value => lib.Express = true },
                { "z|clean", value => lib.Clean = true },
                { "c=|configuration=", value => lib.Configuration = value.ParseEnum <BuildConfiguration>("configuration") },
                { "b=|build-number=", value => { lib.Version = value.ParseString("build-number"); Log.Warning("--build-number is deprecated, please use --version instead."); } },
                { "n=|version=", value => lib.Version = value.ParseString("version") },
                { "C|no-cache", value => lib.CanCache = false },
                { "s|silent", value => lib.SilentBuild = true },
            }.Parse(args);

            Log.ProductHeader();

            // Interpret RebuildList as SourcePaths when a file or directory is specified.
            if (!force && lib.RebuildList.Count > 0 && (
                    File.Exists(lib.RebuildList[0]) ||
                    Directory.Exists(lib.RebuildList[0]) ||
                    lib.RebuildList[0].IndexOf('/') != -1 ||
                    lib.RebuildList[0].IndexOf('\\') != -1))
            {
                lib.RebuiltListIsSourcePaths = true;
            }
            // Repair package caches
            else
            {
                new PackageDoctor(Log)
                .Repair(lib.RebuildList, force);
            }

            lib.Build();
        }
Exemplo n.º 18
0
        public override void Execute(IEnumerable <string> args)
        {
            var force = false;
            var lib   = new LibraryBuilder(Disk, BuildTargets.Package);

            lib.RebuildList = new OptionSet {
                { "a|all", value => lib.RebuildAll = true },
                { "f|force", value => force = true },
                { "x|e|express", value => lib.Express = true },
                { "z|clean", value => lib.Clean = true },
                { "c=|configuration=", value => lib.Configuration = value.ParseEnum <BuildConfiguration>("configuration") },
                { "b=|build-number=", value => lib.Version = value.ParseString("build-number") },
                { "C|no-cache", value => lib.CanCache = false },
                { "s|silent", value => lib.SilentBuild = true },
            }.Parse(args);

            Log.ProductHeader();

            // Repair package caches first
            new PackageDoctor(Log)
            .Repair(lib.RebuildList, force);

            lib.Build();
        }
Exemplo n.º 19
0
 public static byte[] BuildBytes(this LibraryBuilder builder) =>
 new Lokad.ILPack.AssemblyGenerator().GenerateAssemblyBytes(builder.Build());