Exemple #1
0
 public GoalHolder(GoalCommand command) : base(command.View)
 {
     this.command              = command;
     command.View.Click       += delegate { OnItemClick(); };
     command.View.LongClick   += delegate { OnItemLongClick(); };
     command.Mode.ModeChanged += OnModeChanged;
     command.Mode.Refresh     += OnRefresh;
     command.View.FindViewById <CheckBox>(Resource.Id.check_box_goal_item).CheckedChange += (s, e) => OnItemSelected(e);
     BindView();
 }
Exemple #2
0
        public async Task DeleteAsync_WhenIdDoesntExist_ShouldPerformCorrectly(
            SqlConnectionFactory sqlConnectionFactory)
        {
            // Arrange
            var sut    = new GoalCommand(sqlConnectionFactory);
            var goalId = new Guid("74e2948a-0000-0000-0000-2cbed39ae27f");

            // Act
            var result = await sut.DeleteAsync(goalId);

            // Asserts
            result.Should().BeFalse();
        }
Exemple #3
0
        public async Task DeleteAsync_ShouldPerformCorrectly(
            SqlConnectionFactory sqlConnectionFactory)
        {
            // Arrange
            var sut    = new GoalCommand(sqlConnectionFactory);
            var goalId = new Guid("74e2948a-37a4-457d-9254-2cbed39ae27f");

            // Act
            var result = await sut.DeleteAsync(goalId);

            // Asserts
            result.Should().BeTrue();
        }
Exemple #4
0
        public async Task CreateAsync_ShouldPerformCorrectly(
            Goal goal,
            SqlConnectionFactory sqlConnectionFactory)
        {
            // Arrange
            var sut = new GoalCommand(sqlConnectionFactory);

            // Act
            var result = await sut.CreateAsync(goal);

            // Asserts
            result.Should().BeTrue();
        }
Exemple #5
0
        public async Task UpdateAsync_ShouldPerformCorrectly(
            SqlConnectionFactory sqlConnectionFactory)
        {
            // Arrange
            var sut  = new GoalCommand(sqlConnectionFactory);
            var goal = new Goal
            {
                Id    = new Guid("f4f25a21-6a88-4623-89cc-7d0ed349e0ea"),
                Title = "Study Investment",
                Count = 40
            };

            // Act
            var result = await sut.UpdateAsync(goal);

            // Asserts
            result.Should().BeTrue();
        }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            var itemLayout  = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.list_item_goal, parent, false);
            var goalCommand = new GoalCommand
            {
                View                  = itemLayout,
                Resolver              = contentResolver,
                Typeface              = typeface,
                PlaceHolder           = placeholder,
                Resources             = resources,
                ItemClickListener     = OnItemClick,
                ItemLongClickListener = OnItemLongClick,
                Mode                  = this,
                ItemSelected          = OnItemCheckChanged,
                ImageService          = imageService
            };
            var viewHolder = new GoalHolder(goalCommand)
            {
                Resources = resources
            };

            return(viewHolder);
        }