示例#1
0
        public void MapModelsReturnsSuccessForValidDataModelsWithoutLegacyRegions()
        {
            // Arrange
            var appRegistrationModel = ModelBuilders.ValidAppRegistrationModel(ModelBuilders.PathName);
            var legacyPathModel      = ModelBuilders.ValidLegacyPathModel(ModelBuilders.PathName);
            IList <LegacyRegionModel>?legacyRegionModels = null;
            var validRegionModels = ModelBuilders.ValidRegionModels();

            A.CallTo(() => fakeMapper.Map(legacyPathModel, appRegistrationModel));
            A.CallTo(() => fakeMapper.Map <List <RegionModel> >(legacyRegionModels)).Returns(validRegionModels);

            // Act
            modelMappingService.MapModels(appRegistrationModel, legacyPathModel, legacyRegionModels);

            // assert
            A.CallTo(() => fakeMapper.Map(legacyPathModel, appRegistrationModel)).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeMapper.Map <List <RegionModel> >(legacyRegionModels)).MustNotHaveHappened();

            Assert.Null(appRegistrationModel.Regions);
        }