public void GenerateNameTest() { var generatedData = new EmployeeGeneratedData() { gender = "male" }; var names = Substitute.For <NameLists>(); names.PersonName(PersonNames.MaleFirstName).Returns("male"); names.PersonName(PersonNames.FemaleFirstName).Returns("female"); names.PersonName(PersonNames.LastName).Returns("last"); factory.names = names; factory.GenerateName(ref generatedData); Assert.AreEqual("male last", generatedData.name); }