Beispiel #1
0
        public static T MakeSaving <T>(this ITestFixture fixture, Action <T> customizations = null) where T : class
        {
            var entity = fixture.Make(customizations);

            fixture.Save(entity);

            return(entity);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public static TUser MakeSavingLogin <TUser>(this ITestFixture fixture, TUser user)
            where TUser : UserfyUser
        {
            MiruTest.Log.Debug(() => $"Saving: {user}");

            fixture.Save(user);

            fixture.LoginAs(user);

            return(user);
        }
Beispiel #4
0
        public static IEnumerable <T> MakeManySaving <T>(this ITestFixture fixture, int howMany = 3, Action <T> customizations = null) where T : class
        {
            MiruTest.Log.Information($"Making and saving {howMany} {typeof(T).FullName}");

            var entities = fixture.Get <Fabricator>().MakeMany(howMany, customizations);

            MiruTest.Log.Debug(() => $"Made:{Environment.NewLine}{entities.Inspect()}");

            MiruTest.Log.Debug(() => $"Saving the {howMany} entities");

            fixture.Save(entities);

            return(entities);
        }
Beispiel #5
0
        public async Task Build(ITestFixture _)
        {
            Area1 = _.Make <Area>();
            Area2 = _.Make <Area>();
            Goal1 = _.Make <Goal>(x => x.Area = Area1);
            Goal2 = _.Make <Goal>(x => x.Area = Area1);
            Goal3 = _.Make <Goal>(x => x.Area = Area2);
            Goal4 = _.Make <Goal>(x => x.Area = Area2);

            DeletedArea      = _.Make <Area>(m => m.IsInactive = true);
            DeletedGoal      = _.Make <Goal>(m => { m.Area = DeletedArea; m.IsInactive = true; });
            DeletedGoalArea1 = _.Make <Goal>(m => { m.Area = Area1; m.IsInactive = true; });

            // TODO: _.SaveMade()
            await _.Save(Area1, Area2, Goal1, Goal2, Goal3, Goal4, DeletedArea, DeletedGoal, DeletedGoalArea1);
        }
Beispiel #6
0
        public async Task Build(ITestFixture _)
        {
            User = _.MakeSavingLogin <User>();

            Work     = _.Make <Area>();
            WorkLess = _.Make <Goal>(m => m.Area = Work);

            Health     = _.Make <Area>();
            DrinkWater = _.Make <Goal>(m => m.Area = Health);
            GoalEdit   = _.Make <Goal>(m => m.Area = Health);
            GoalRemove = _.Make <Goal>(m => m.Area = Health);

            AreaToRemove     = _.Make <Area>();
            GoalAreaToRemove = _.Make <Goal>(m => m.Area = AreaToRemove);

            AreaToEdit = _.Make <Area>();

            await _.Save(
                Work, WorkLess,
                Health, DrinkWater, GoalEdit, GoalRemove,
                AreaToRemove, GoalAreaToRemove,
                AreaToEdit);
        }