public void TestGetSmallerMapStorageChoosesDefaultImpl() { AreaCodeMapStorageStrategy mapStorage = new AreaCodeMap().getSmallerMapStorage(createDefaultStorageMapCandidate()); Assert.IsFalse(mapStorage.GetType() == typeof(FlyweightMapStorage)); }
public void TestGetSmallerMapStorageChoosesFlyweightImpl() { var mapStorage = new AreaCodeMap().GetSmallerMapStorage(CreateFlyweightStorageMapCandidate()); Assert.True(mapStorage.GetType() == typeof(FlyweightMapStorage)); }
[TestMethod] public void testGetSmallerMapStorageChoosesFlyweightImpl() { AreaCodeMapStorageStrategy mapStorage = new AreaCodeMap().getSmallerMapStorage(createFlyweightStorageMapCandidate()); assertTrue(mapStorage is FlyweightMapStorage); }
[TestMethod] public void testReadWriteExternalWithFlyweightStrategy() { AreaCodeMap localAreaCodeMap = new AreaCodeMap(); localAreaCodeMap.readAreaCodeMap(createFlyweightStorageMapCandidate()); assertTrue(localAreaCodeMap.getAreaCodeMapStorage() is FlyweightMapStorage); AreaCodeMap newAreaCodeMap; newAreaCodeMap = createNewAreaCodeMap(localAreaCodeMap); assertEquals(localAreaCodeMap.toString(), newAreaCodeMap.toString()); }
/** * Creates a new area code map serializing the provided area code map to a stream and then reading * this stream. The resulting area code map is expected to be strictly equal to the provided one * from which it was generated. */ private static AreaCodeMap createNewAreaCodeMap(AreaCodeMap areaCodeMap) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); areaCodeMap.writeExternal(objectOutputStream); objectOutputStream.flush(); AreaCodeMap newAreaCodeMap = new AreaCodeMap(); newAreaCodeMap.readExternal( new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()))); return(newAreaCodeMap); }
public void TestGetSmallerMapStorageChoosesFlyweightImpl() { AreaCodeMapStorageStrategy mapStorage = new AreaCodeMap().getSmallerMapStorage(createFlyweightStorageMapCandidate()); Assert.True(mapStorage.GetType() == typeof(FlyweightMapStorage)); }