コード例 #1
0
        public void SaveMapWithName_HappyDay()
        {
            // arrange
            const string MapName       = "Map1";
            var          mapDataAccess = new MapDataAccessMock();
            var          controller    = new MapController(mapDataAccess);

            // act
            controller.NewMap(MapName);

            // assert
            Assert.IsNotNull(controller.MapDataAccess);
            Assert.AreEqual(mapDataAccess, controller.MapDataAccess);
            Assert.IsNotNull(mapDataAccess.MapToSave);
            Assert.AreEqual(MapName, mapDataAccess.MapToSave.Name);
            Assert.AreNotEqual(Guid.Empty, mapDataAccess.MapToSave.Id);
        }
コード例 #2
0
        public void Save_HappyDay()
        {
            // arrange
            const string MapName       = "Map1";
            var          mapDataAccess = new MapDataAccessMock();
            var          controller    = new MapController(mapDataAccess);
            var          map           = Map.NewMap();

            map.Name = MapName;

            // act
            controller.Save(map);

            // assert
            Assert.IsNotNull(controller.MapDataAccess);
            Assert.AreEqual(mapDataAccess, controller.MapDataAccess);
            Assert.IsNotNull(mapDataAccess.MapToSave);
            Assert.AreEqual(map, mapDataAccess.MapToSave);
        }