public ExposedProtectedFieldsMockTeleportStation( IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location) : base(owner, galacticMap, location) { }
public TeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location) { this.owner = owner; this.galacticMap = galacticMap; this.location = location; this.resources = new Resources(); }
public TeleportStation(IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location) { this.OwnerOfStation = owner; this.GalacticMapOfStation = galacticMap; this.LocationOfStation = location; this.ResourcesOfStation = new Resources(); }
public TeleportStation(IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location) { this.owner = owner; this.galacticMap = galacticMap; this.location = location; this.resources = new Resources(); }
public MockedTeleportStation(IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location) : base(owner, galacticMap, location) { this.Owner = owner; this.GalacticMap = galacticMap; this.Location = location; this.Resources = new Resources(); }
public MockedTeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location) : base(owner, galacticMap, location) { this.Owner = owner; this.GalacticMap = galacticMap; this.Location = location; this.Resources = new Resources(); }
public IResources PayProfits(IBusinessOwner owner) { if (this.owner.IdentificationNumber != owner.IdentificationNumber) { throw new UnauthorizedAccessException("Payments are allowed only to the owner"); } var payment = this.resources.Clone(); this.resources.Clear(); return payment; }
public IResources PayProfits(IBusinessOwner owner) { if (this.OwnerOfStation.IdentificationNumber != owner.IdentificationNumber) { throw new UnauthorizedAccessException("Payments are allowed only to the owner"); } var payment = this.ResourcesOfStation.Clone(); this.ResourcesOfStation.Clear(); return(payment); }
public void SetUpAllTheProdivedFields_WhenNewInstanceIsCreated() { // Arrange var ownerMock = new Mock <IBusinessOwner>(); var galacticMapMock = new Mock <IEnumerable <IPath> >(); var locationMock = new Mock <ILocation>(); IBusinessOwner expectedOwner = ownerMock.Object; IEnumerable <IPath> expectedMap = galacticMapMock.Object; ILocation expectedLocation = locationMock.Object; // Act ExtendedTeleportStation teleportStation = new ExtendedTeleportStation(expectedOwner, expectedMap, expectedLocation); IBusinessOwner actualOwner = teleportStation.Owner; IEnumerable <IPath> actualMap = teleportStation.GalacticMap; ILocation actualLocation = teleportStation.Location; // Assert Assert.AreEqual(expectedOwner, actualOwner); Assert.AreEqual(expectedMap, actualMap); Assert.AreEqual(expectedLocation, actualLocation); }
internal static ExtendedTeleportStation ArrangeTeleportStation() { var ownerMock = new Mock <IBusinessOwner>(); var locationMock = new Mock <ILocation>(); var pathMock = new Mock <IPath>(); var unitMock = new Mock <IUnit>(); ownerMock.Setup(o => o.IdentificationNumber).Returns(TeleportStationConstants.IdentificationNumber); locationMock.Setup(l => l.Planet.Galaxy.Name).Returns(TeleportStationConstants.Galaxy); locationMock.Setup(l => l.Planet.Name).Returns(TeleportStationConstants.Location); locationMock.Setup(l => l.Coordinates.Longtitude).Returns(TeleportStationConstants.Longtitude); locationMock.Setup(l => l.Coordinates.Latitude).Returns(TeleportStationConstants.Latitude); IBusinessOwner expectedOwner = ownerMock.Object; IEnumerable <IPath> expectedMap = ArrangeGalacticMock(ref pathMock, ref unitMock); ILocation expectedLocation = locationMock.Object; ExtendedTeleportStation teleportStation = new ExtendedTeleportStation(expectedOwner, expectedMap, expectedLocation); return(teleportStation); }
public void ReturnTheTotalAmountOfProfits_WhenTheArgumentPassedIsTheActualOwner() { // Arrange var unitToTeleportMock = new Mock <IUnit>(); var targetLocationMock = new Mock <ILocation>(); var ownerMock = new Mock <IBusinessOwner>(); ExtendedTeleportStation teleportStation = TeleportStationHelpers.ArrangeTeleportStation(); TeleportStationHelpers.SetupUnitToTeleport(ref unitToTeleportMock, TeleportStationConstants.Galaxy, TeleportStationConstants.Location); TeleportStationHelpers.SetupTargetLocation(ref targetLocationMock, TeleportStationConstants.Galaxy, TeleportStationConstants.Location, TeleportStationConstants.OtherLongtitude, TeleportStationConstants.OtherLatitude); ownerMock.Setup(o => o.IdentificationNumber).Returns(TeleportStationConstants.IdentificationNumber); unitToTeleportMock.Setup(u => u.CanPay(It.IsAny <IResources>())).Returns(true); unitToTeleportMock.Setup(u => u.Pay(TeleportStationHelpers.Path.Cost)).Returns(TeleportStationHelpers.Path.Cost); IUnit expectedUnitToTeleport = unitToTeleportMock.Object; ILocation expectedTargetLocation = targetLocationMock.Object; IBusinessOwner expectedOwner = ownerMock.Object; teleportStation.TeleportUnit(expectedUnitToTeleport, expectedTargetLocation); uint expectedBronzeCoins = teleportStation.Resources.BronzeCoins; uint expectedSilverCoins = teleportStation.Resources.SilverCoins; uint expectedGoldCoins = teleportStation.Resources.GoldCoins; // Act IResources resources = teleportStation.PayProfits(expectedOwner); uint actualBronzeCoins = resources.BronzeCoins; uint actualSilverCoins = resources.SilverCoins; uint actualGoldCoins = resources.GoldCoins; // Assert Assert.AreEqual(expectedBronzeCoins, actualBronzeCoins); Assert.AreEqual(expectedSilverCoins, actualSilverCoins); Assert.AreEqual(expectedGoldCoins, actualGoldCoins); }
public TeleportStationMock(IBusinessOwner owner, IEnumerable <IPath> galacticMap, ILocation location) : base(owner, galacticMap, location) { }
public MockedTeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location) : base(owner, galacticMap, location) { resources = new Resources(); }