public void AddCreaturePacket_Initialization() { const OutboundPacketType ExpectedPacketType = OutboundPacketType.AddThing; var creatureMock = new Mock <ICreature>(); var playerMock = new Mock <IPlayer>(); ExceptionAssert.Throws <ArgumentException>(() => new AddCreaturePacket(null, creatureMock.Object), "Value cannot be null. (Parameter 'player')"); ExceptionAssert.Throws <ArgumentException>(() => new AddCreaturePacket(playerMock.Object, null), "Value cannot be null. (Parameter 'creature')"); var packet = new AddCreaturePacket(playerMock.Object, creatureMock.Object); Assert.AreEqual(ExpectedPacketType, packet.PacketType, $"Expected {nameof(packet.PacketType)} to match {ExpectedPacketType}."); Assert.AreSame(creatureMock.Object, packet.Creature, $"Expected {nameof(packet.Creature)} to be the same instance as {creatureMock.Object}."); }
public void AddCreaturePacket_Initialization() { const OutgoingPacketType ExpectedPacketType = OutgoingPacketType.AddThing; const bool ExpectedAsKnownValue = true; const uint ExpectedCreatureIdToRemove = 1; ExceptionAssert.Throws <ArgumentException>(() => new AddCreaturePacket(null, ExpectedAsKnownValue, ExpectedCreatureIdToRemove), "Value cannot be null. (Parameter 'creature')"); var creatureMock = new Mock <ICreature>(); var packet = new AddCreaturePacket(creatureMock.Object, ExpectedAsKnownValue, ExpectedCreatureIdToRemove); Assert.AreEqual(ExpectedPacketType, packet.PacketType, $"Expected {nameof(packet.PacketType)} to match {ExpectedPacketType}."); Assert.AreSame(creatureMock.Object, packet.Creature, $"Expected {nameof(packet.Creature)} to be the same instance as {creatureMock.Object}."); Assert.AreEqual(ExpectedAsKnownValue, packet.AsKnown, $"Expected {nameof(packet.AsKnown)} to match {ExpectedAsKnownValue}."); Assert.AreEqual(ExpectedCreatureIdToRemove, packet.RemoveThisCreatureId, $"Expected {nameof(packet.RemoveThisCreatureId)} to match {ExpectedCreatureIdToRemove}."); }