public void AddLocation_LocationIsInList_IsNotAddedToLocations()
        {
            using (ShimsContext.Create())
            {
                IFingerprint fingerprint = new StubIFingerprint();

                Issue     issue          = new Issue(fingerprint, IssueType);
                ILocation actualLocation = null;
                ILocation location       = new StubILocation
                {
                    EqualsILocation = (l) => { actualLocation = l; return(true); }
                };

                Assert.AreEqual(AddResult.ItemAdded, issue.AddLocation(location));

                List <ILocation> locationList = issue.Locations.ToList();

                Assert.AreEqual(1, locationList.Count);
                Assert.AreSame(location, locationList[0]);
                Assert.IsNull(actualLocation);

                Assert.AreEqual(AddResult.ItemAlreadyExists, issue.AddLocation(location));
                Assert.AreEqual(1, issue.Locations.Count());
                Assert.AreSame(location, actualLocation);
            }
        }
        public void AddLocation_LocationIsNotInList_IsAddedToLocations()
        {
            using (ShimsContext.Create())
            {
                IFingerprint fingerprint = new StubIFingerprint();

                Issue issue = new Issue(fingerprint, IssueType);

                ILocation location = new StubILocation();

                Assert.AreEqual(AddResult.ItemAdded, issue.AddLocation(location));

                List <ILocation> locationList = issue.Locations.ToList();

                Assert.AreEqual(1, locationList.Count);
                Assert.AreSame(location, locationList[0]);
            }
        }
        public void AddLocation_LocationIsNull_ThrowsArgumentNullException()
        {
            using (ShimsContext.Create())
            {
                IFingerprint fingerprint = new StubIFingerprint();

                Issue issue = new Issue(fingerprint, IssueType);

                try
                {
                    issue.AddLocation(null);
                }
                catch (ArgumentNullException e)
                {
                    Assert.AreEqual("location", e.ParamName);
                    throw;
                }
            }
        }