public void T002_FindAdvertTypeByMask_SequenceContainsMoreThanOneElement_Exception()
        {
            // Arrange
            var advertTypeRepo = new Mock <IGenericRepository <AdvertType> >();

            advertTypeRepo.Setup(x => x.GetSet()).Returns(new List <AdvertType>());

            // Act

            var getAdvertTypes = new GetAdvertTypes(advertTypeRepo.Object);
            var result         = getAdvertTypes.FindAdvertTypeByMask(1);
        }
示例#2
0
        public void T001_FindAdvertTypeByMask_MaskNotFound_InvalidOperationException()
        {
            // Arrange
            var advertTypeRepo = new Mock <IGenericRepository <AdvertType> >();

            advertTypeRepo.Setup(x => x.GetSet()).Returns(new List <AdvertType>());

            // Act
            var getAdvertTypes = new GetAdvertTypes(advertTypeRepo.Object);
            var result         = getAdvertTypes.FindAdvertTypeByMask(10);

            // Assert
        }
        public void  T001_FindAdvertTypeByMask_MaskNotFound_Exception()
        {
            // Arrange
            var advertTypeRepo = new Mock <IGenericRepository <AdvertType> >();

            advertTypeRepo.Setup(x => x.GetSet()).Returns(new List <AdvertType> {
                new AdvertType()
                {
                    Mask = 1
                }, new AdvertType {
                    Mask = 1
                }
            });

            // Act
            var getAdvertTypes = new GetAdvertTypes(advertTypeRepo.Object);
            var result         = getAdvertTypes.FindAdvertTypeByMask(0);
        }
        public void T004_GetAdvertTypeNameAndMask_AdvertTypeExists_ReturnProperMaskAndName()
        {
            // Arrange
            var          advertTypeRepo = new Mock <IGenericRepository <AdvertType> >();
            const string expectedName   = "testName";

            advertTypeRepo.Setup(x => x.GetSet())
            .Returns(new List <AdvertType>()
            {
                new AdvertType()
                {
                    Mask = 1, Name = expectedName
                }
            });

            // Act
            var getAdvertTypes = new GetAdvertTypes(advertTypeRepo.Object);
            var result         = getAdvertTypes.FindAdvertTypeByMask(1);

            // Assert
            Assert.AreEqual(result.Name, expectedName);
        }
示例#5
0
        public void T002_FindAdvertTypeByMask_MoreThanOneAdvertTypeFound_InvalidOperationException()
        {
            // Arrange
            var advertTypeRepo = new Mock <IGenericRepository <AdvertType> >();

            advertTypeRepo.Setup(x => x.GetSet()).Returns(new List <AdvertType>()
            {
                new AdvertType()
                {
                    Mask = 2
                }, new AdvertType()
                {
                    Mask = 2
                }
            });

            // Act
            var advertTypes = new GetAdvertTypes(advertTypeRepo.Object);

            advertTypes.FindAdvertTypeByMask(2);

            // Assert
        }