Exemple #1
0
        public static async Task <TResult> ShouldAuthorize <TResult, TUser>(
            this ITestFixture fixture,
            TUser user,
            IRequest <TResult> message) where TUser : UserfyUser
        {
            fixture.LoginAs(user);

            return(await fixture.App.SendAsync(message));
        }
Exemple #2
0
        public static async Task ShouldNotAuthorize <TResult, TUser>(
            this ITestFixture fixture,
            TUser user,
            IRequest <TResult> message) where TUser : UserfyUser
        {
            fixture.LoginAs(user);

            await Should.ThrowAsync <UnauthorizedException>(async() => await fixture.App.SendAsync(message));
        }
Exemple #3
0
        public async Task Build(ITestFixture _)
        {
            User     = _.Make <User>(m => m.HashedPassword = Hash.Create("123456"));
            Provider = _.Make <Provider>(m => m.Amounts = "10,20");

            await _.Save(User, Provider);

            _.LoginAs(User);
        }
Exemple #4
0
        public static TUser MakeSavingLogin <TUser>(this ITestFixture fixture, TUser user) where TUser : class, IUser
        {
            MiruTest.Log.Debug(() => $"Saving: {user}");

            fixture.SaveSync(user);

            fixture.LoginAs(user);

            return(user);
        }