public void CreateInstancesReadsInstancesCorrectly() { AcLibUtilsTest.WriteFile(new[] { "330 ba", "2147483648 foo/bar" }, AcLibUtilsTest.InstanceSpecificationFile); var instances = AcLibUtils.CreateInstances(AcLibUtilsTest.InstanceSpecificationFile); Assert.Equal(2, instances.Count); Assert.Equal("ba", instances[0].Path); Assert.Equal(330, instances[0].Seed); Assert.Equal("foo/bar", instances[1].Path); Assert.Equal(int.MinValue, instances[1].Seed); }
public void CreateInstancesThrowsForNegativeSeed() { AcLibUtilsTest.WriteFile(new[] { "0 a", "-1 b" }, AcLibUtilsTest.InstanceSpecificationFile); Assert.Throws <OverflowException>(() => AcLibUtils.CreateInstances(AcLibUtilsTest.InstanceSpecificationFile)); }
public void CreateInstancesThrowsForTooMuchInformation() { AcLibUtilsTest.WriteFile(new[] { "0 a", "330 b x" }, AcLibUtilsTest.InstanceSpecificationFile); Assert.Throws <ArgumentException>(() => AcLibUtils.CreateInstances(AcLibUtilsTest.InstanceSpecificationFile)); }
public void CreateInstancesThrowsForWrongSeedFormat() { AcLibUtilsTest.WriteFile(new[] { "0 a", "4f b" }, AcLibUtilsTest.InstanceSpecificationFile); Assert.Throws <FormatException>(() => AcLibUtils.CreateInstances(AcLibUtilsTest.InstanceSpecificationFile)); }
public void CreateInstancesThrowsForMissingInstanceFile() { Assert.Throws <FileNotFoundException>(() => AcLibUtils.CreateInstances(AcLibUtilsTest.InstanceSpecificationFile)); }