Esempio n. 1
0
        public void SettingValues()
        {
            var sut = new EditLocationResults
            {
                Zip = "a",
                NumCompletionEvents  = 1,
                NumEvents            = 3,
                NumLocations         = 5,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    }
                }
            };

            Assert.AreEqual("a", sut.Zip);
            Assert.AreEqual(1, sut.NumCompletionEvents);
            Assert.AreEqual(3, sut.NumEvents);
            Assert.AreEqual(5, sut.NumLocations);
            Assert.AreEqual(Lists.NewList(new RelativeEditLocation {
                Location = 1, Size = 2
            }), sut.AppliedEditLocations);
            Assert.AreEqual(Lists.NewList(new RelativeEditLocation {
                Location = 3, Size = 4
            }), sut.OtherEditLocations);
        }
        public void Integration()
        {
            var sut = new EditLocationAnalysisLogger();

            sut.SearchingZips("C:\\a\\b\\");
            sut.FoundZips(123);

            sut.StartingStatCreation(1);
            sut.StartingStatCreation(2);
            sut.CreatingStats(1, "a/b.zip");
            sut.CreatingStats(1, "c.zip");
            sut.CreatingStats(1, "d.zip");

            sut.IntermediateResults(
                1,
                new EditLocationResults
            {
                Zip                  = "a.zip",
                NumEvents            = 10,
                NumCompletionEvents  = 5,
                NumLocations         = 2,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    }
                }
            });

            sut.FinishedStatCreation(1);
            sut.FinishedStatCreation(2);

            var res = new EditLocationResults
            {
                Zip                 = "all",
                NumEvents           = 10,
                NumCompletionEvents = 5,
                NumLocations        = 2
            };

            var rng = new Random();

            for (var i = 0; i < 10; i++)
            {
                res.AppliedEditLocations.Add(CreateRandomLocation(rng));
            }
            for (var i = 0; i < 10; i++)
            {
                res.OtherEditLocations.Add(CreateRandomLocation(rng));
            }

            sut.FinalResults(res);
        }
Esempio n. 3
0
        public void Equality_Default()
        {
            var a = new EditLocationResults();
            var b = new EditLocationResults();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 4
0
        public void Equality_DifferentNumHistoryTuples()
        {
            var a = new EditLocationResults
            {
                NumLocations = 5
            };
            var b = new EditLocationResults();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 5
0
        public void Equality_DifferentNumEvents()
        {
            var a = new EditLocationResults
            {
                NumEvents = 3
            };
            var b = new EditLocationResults();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 6
0
        public void Equality_DifferentZip()
        {
            var a = new EditLocationResults
            {
                Zip = "a"
            };
            var b = new EditLocationResults();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 7
0
        public void Defaults()
        {
            var sut = new EditLocationResults();

            Assert.AreEqual("", sut.Zip);
            Assert.AreEqual(0, sut.NumCompletionEvents);
            Assert.AreEqual(0, sut.NumEvents);
            Assert.AreEqual(0, sut.NumLocations);
            Assert.AreEqual(Lists.NewList <RelativeEditLocation>(), sut.AppliedEditLocations);
            Assert.AreEqual(Lists.NewList <RelativeEditLocation>(), sut.OtherEditLocations);

            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
Esempio n. 8
0
        public void Equality_DifferentOtherEditLocations()
        {
            var a = new EditLocationResults
            {
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                }
            };
            var b = new EditLocationResults();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 9
0
        public void Equality_WithValuesSet()
        {
            var a = new EditLocationResults
            {
                Zip = "a",
                NumCompletionEvents  = 1,
                NumEvents            = 3,
                NumLocations         = 5,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    }
                }
            };
            var b = new EditLocationResults
            {
                Zip = "a",
                NumCompletionEvents  = 1,
                NumEvents            = 3,
                NumLocations         = 5,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    }
                }
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 10
0
        public void Add()
        {
            var a = new EditLocationResults
            {
                Zip = "a",
                NumCompletionEvents  = 1,
                NumEvents            = 3,
                NumLocations         = 5,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    }
                }
            };

            a.Add(
                new EditLocationResults
            {
                Zip = "b",
                NumCompletionEvents  = 1 + 1,
                NumEvents            = 3 + 1,
                NumLocations         = 5 + 1,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 3
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 4, Size = 5
                    }
                }
            });
            var b = new EditLocationResults
            {
                Zip = "a",
                NumCompletionEvents  = 2 * 1 + 1,
                NumEvents            = 2 * 3 + 1,
                NumLocations         = 2 * 5 + 1,
                AppliedEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 1, Size = 2
                    },
                    new RelativeEditLocation {
                        Location = 1, Size = 3
                    }
                },
                OtherEditLocations =
                {
                    new RelativeEditLocation {
                        Location = 3, Size = 4
                    },
                    new RelativeEditLocation {
                        Location = 4, Size = 5
                    }
                }
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }