public void Location_RandomFullConstructor() { for (int j = 0; j < 100; j++) { int testSize = rnd.Next(1, 10000); int maxItems = rnd.Next(1, 10000); int maxAmount = rnd.Next(1, 10000); l.GenerateSubLocations(testSize, maxItems, maxAmount); Sublocation last = new Residential(); Assert.IsFalse(l.GetVisited(), "New Location should not be visited"); Assert.IsTrue(l.IsCurrentSublocationNull(), "Current sublocation should be null"); Assert.AreEqual(null, l.GetCurrentSubLocation(), "Current Sublocation should be null"); Assert.AreEqual(testSize, l.GetSize(), "Size should be " + testSize); for (int i = 1; i < testSize + 1; i++) { Assert.IsTrue(l.SetCurrentSubLocation(i), "Setting to an id which exists (" + i + ") should be succesful"); Assert.IsFalse(l.IsCurrentSublocationNull(), "Current sublocation should not be null"); last = l.GetCurrentSubLocation(); Assert.AreEqual(i, last.GetSublocationID(), "IDs should match"); Assert.AreEqual(maxItems, last.GetMaxItems(), "Max items should match"); Assert.AreEqual(maxAmount, last.GetMaxAmount(), "Max amount should match"); } Assert.IsFalse(l.SetCurrentSubLocation(testSize + 1), "Setting to an id which does not exists (" + (testSize + 1) + ") should be unsuccesful"); Assert.IsFalse(l.IsCurrentSublocationNull(), "Current sublocation should not be null"); Assert.AreEqual(last, l.GetCurrentSubLocation(), "Current Sublocation should have remained the same"); } }
public void Residential_StandardConstructor() { Assert.IsFalse(res.GetScavenged(), "Should not be scavenged"); Assert.AreEqual(1, res.GetSublocationID(), "ID should be 1"); Assert.AreEqual(3, res.GetMaxItems(), "Max items should be 3"); Assert.AreEqual(5, res.GetMaxAmount(), "Max amount should be 5"); }
public void Location_GenerateFixedSize() { int testSize = 6; l = new Location(); l.GenerateSubLocations(testSize); Sublocation last = new Residential(); Assert.IsFalse(l.GetVisited(), "New Location should not be visited"); Assert.IsTrue(l.IsCurrentSublocationNull(), "Current sublocation should be null"); Assert.AreEqual(null, l.GetCurrentSubLocation(), "Current Sublocation should be null"); Assert.AreEqual(testSize, l.GetSize(), "Size should be " + testSize); for (int i = 1; i < testSize + 1; i++) { Assert.IsTrue(l.SetCurrentSubLocation(i), "Setting to an id which exists (" + i + ") should be succesful"); Assert.IsFalse(l.IsCurrentSublocationNull(), "Current sublocation should not be null"); last = l.GetCurrentSubLocation(); Assert.AreEqual(i, last.GetSublocationID(), "IDs should match"); } Assert.IsFalse(l.SetCurrentSubLocation(testSize + 1), "Setting to an id which does not exists (" + (testSize + 1) + ") should be unsuccesful"); Assert.IsFalse(l.IsCurrentSublocationNull(), "Current sublocation should not be null"); Assert.AreEqual(last, l.GetCurrentSubLocation(), "Current Sublocation should have remained the same"); }