public void Generate_Should_Return_Correct_UniqueName_When_DataSource_Contains_One_Item()
        {
            var categoryList = new List <Category>();

            var database = new Mock <IDatabase>();

            database.SetupGet(d => d.CategoryDataSource).Returns(categoryList.AsQueryable());

            var category = (Category)_factory.CreateCategory("C");

            category.UniqueName = UniqueNameGenerator.GenerateFrom(database.Object.CategoryDataSource, category.Name);
            categoryList.Add(category);
            Thread.Sleep(500);

            string uniqueName = UniqueNameGenerator.GenerateFrom(database.Object.CategoryDataSource, "C++");

            Assert.Equal("C-2", uniqueName);
        }
        private IStory CreateStory(bool approved)
        {
            var category = _factory.CreateCategory("test");
            var user     = _factory.CreateUser("test", "*****@*****.**", "xxxxxxxx");

            var story = _factory.CreateStory(category, user, "192.168.0.1", "Test Story", "Test Story Description", "http://astory.com");

            if (approved)
            {
                story.Approve(SystemTime.Now());
            }

            return(story);
        }
        public void Add_Should_Use_Database()
        {
            database.Setup(d => d.Insert(It.IsAny <Category>())).Verifiable();

            _categoryRepository.Add(_factory.CreateCategory("Dummy Category"));
        }
        public void Add_Should_Use_Database()
        {
            _categoryRepository.Add(_factory.CreateCategory("Dummy Category"));

            database.Verify(d => d.InsertOnSubmit(It.IsAny <Category>()));
        }