Esempio n. 1
0
        public void Update()
        {
            // Arrange
            var updateSet = new SetDTO
            {
                Id        = 2,
                SpentTime = 355
            };

            _mock.Setup(s => s.Update(It.IsAny <SetDTO>())).Callback <SetDTO>(updateValue =>
            {
                updateValue.ModifiedDate = DateTime.Now;
                var setIndex             = _sets.FindIndex(set => set.Id == updateValue.Id);
                _sets[setIndex]          = updateValue;
            });

            // Act
            var result = _setService.Update(updateSet);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IOperationResult));
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.ResultItemId > 0);
            Assert.AreEqual(_sets.Find(set => set.Id == updateSet.Id).SpentTime, updateSet.SpentTime);
        }
Esempio n. 2
0
        public async Task Update_FirstMatches_CreatesMatchesAndMatchCharacters()
        {
            var set = SetUtility.Create(dbContext);

            var matchForms = CreateMatchForms(3);
            await testObj.Update(set.ID, matchForms);

            Assert.AreEqual(3, set.Matches.Count);
        }