Example #1
0
        public void CanDeleteUpdateTagType()
        {
            Mock <ITagTypeRepository> mock       = new Mock <ITagTypeRepository>();
            TagTypeController         controller = new TagTypeController(mock.Object);

            controller.Delete(1);
        }
Example #2
0
        public void CanUpdateTagType()
        {
            Mock <ITagTypeRepository> mock       = new Mock <ITagTypeRepository>();
            TagTypeController         controller = new TagTypeController(mock.Object);

            controller.Put(new TagType {
                Id = 1, Description = "abc"
            });
        }
Example #3
0
        public void CanGetTagType()
        {
            TagType expected = new TagType {
                Id = 1, Description = "abc"
            };
            Mock <ITagTypeRepository> mock = new Mock <ITagTypeRepository>();

            mock.Setup(f => f.GetById(It.IsAny <int>()))
            .Returns(expected);

            TagTypeController controller = new TagTypeController(mock.Object);

            Assert.AreEqual(expected, controller.Get(1));
        }
Example #4
0
        public void CanFailGetTagType()
        {
            TagType expected = new TagType {
                Id = 1, Description = "abc"
            };
            Mock <ITagTypeRepository> mock = new Mock <ITagTypeRepository>();

            mock.Setup(f => f.GetById(1))
            .Returns(expected);

            TagTypeController controller = new TagTypeController(mock.Object);

            TagType tagType = controller.Get(2);

            Assert.AreNotEqual(expected, tagType);
        }
Example #5
0
        public void CanGetAllTagTypes()
        {
            TagType[] expected =
            {
                new TagType {
                    Id = 1, Description = "abc"
                },
                new TagType {
                    Id = 2, Description = "def"
                }
            };
            Mock <ITagTypeRepository> mock = new Mock <ITagTypeRepository>();

            mock.Setup(f => f.GetAll())
            .Returns(expected);

            TagTypeController controller = new TagTypeController(mock.Object);

            TagType[] tagTypes = controller.Get().ToArray();

            Assert.AreEqual(expected, tagTypes);
        }