コード例 #1
0
        public void InsertShouldUpdateLastModifiedTime()
        {
            var sut = new PrivateRecipe(_author, _title);
            var recipeItem1 = new RecipeItem(_itemDescription, sut);
            var recipeItem2 = new RecipeItem(_itemDescription, sut);

            sut.Add(recipeItem1);
            var oldTime = sut.TimeLastModified;

            Thread.Sleep(100);

            sut.Insert(recipeItem2, 0);
            var newTime = sut.TimeLastModified;

            newTime.ShouldNotEqual(oldTime);
        }
コード例 #2
0
        public void InsertShouldInsertItemAtSpecifiedIndex()
        {
            var sut = new PrivateRecipe(_author, _title);
            var recipeItem1 = new RecipeItem(_itemDescription, sut);
            var recipeItem2 = new RecipeItem(_itemDescription, sut);

            sut.Add(recipeItem1);
            sut.Insert(recipeItem2, 0);

            sut.Items[0].ShouldBeSameAs(recipeItem2);
        }