예제 #1
0
        public void GetInvalidRegionByIdTestClientError()
        {
            var    regionId = Guid.NewGuid();
            Region region   = new Region
            {
                Id   = regionId,
                Name = Region.RegionName.Región_Centro_Sur
            };

            var regionMock = new Mock <IRepository <Region> >(MockBehavior.Strict);

            regionMock.Setup(x => x.Get(It.IsAny <Guid>())).Throws(new ClientException());

            RegionManagement regionLogic = new RegionManagement(regionMock.Object);

            regionLogic.GetById(regionId);
        }
예제 #2
0
        public void GetRegionValidByIdTestOk()
        {
            Region region = new Region
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Centro_Sur
            };
            var regionMock = new Mock <IRepository <Region> >(MockBehavior.Strict);

            regionMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(region);

            RegionManagement regionLogic = new RegionManagement(regionMock.Object);

            Region result = regionLogic.GetById(region.Id);

            Region regiontToCompare = new Region()
            {
                Id   = result.Id,
                Name = result.Name
            };

            regionMock.VerifyAll();
            Assert.AreEqual(region, regiontToCompare);
        }