Beispiel #1
0
        public void Setup()
        {
            this.entity = new Shoutout();
            this.model  = new ShoutoutModel();

            this.mapper = new ShoutoutMapper();
        }
        public void RemoveShoutoutCommandShouldRemoveShoutout()
        {
            ShoutoutModel model = new ShoutoutModel();

            this.viewModel.Shoutouts.Add(model);

            this.viewModel.RemoveShoutoutCommand.Execute(model);

            Assert.AreEqual(0, this.viewModel.Shoutouts.Count);
        }
        public void UpdatingAShoutoutShouldDelegateToRepository(string shoutoutText, bool expected)
        {
            ShoutoutModel model = new ShoutoutModel {
                Command = "a"
            };

            this.viewModel.Shoutouts.Add(model);
            this.viewModel.IsSelected = true;

            model.Message = shoutoutText;

            this.repository.Verify(r => r.AddOrUpdate(It.IsAny <Shoutout>()), () => expected ? Times.Once() : Times.Never());
            this.mapper.Verify(m => m.MapToEntity(It.IsAny <ShoutoutModel>(), It.IsAny <Shoutout>()), () => expected ? Times.Once() : Times.Never());
        }