public void Create_ThrowsException_WhenProfileWithSameNameAlreadyExists() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act storage.Create("default"); }
public void Create_CreatesNewCSV_WithTheNameOfTheProfile() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act storage.Create("new"); // Assert Assert.IsTrue(_fileSystem.FileExists(Path.Combine(FileSystemProfileStorage.PROFILE_FOLDER_PATH, "new.csv"))); }
public void Exists_IsCaseInsensitive() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act bool actual = storage.Exists("DEfault"); // Assert Assert.IsTrue(actual); }
public void Exists_ReturnsTrue_OnlyWhenACSVWithTheSameNameExistsInTheFileSystem(string profileName, bool expected) { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act bool actual = storage.Exists(profileName); // Assert Assert.AreEqual(expected, actual); }
public void CreatingThenGettingAProfile_ReturnsTheSameInstance() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act IProfile created = storage.Create("foo"); IProfile gotten = storage.Get("foo"); // Assert Assert.AreSame(created, gotten); }
public void SubsequentProfileGets_ReturnTheSameProfileInstance() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act IProfile resultOne = storage.Get("default"); IProfile resultTwo = storage.Get("default"); // Assert Assert.AreSame(resultOne, resultTwo); }
public void CreatingAndIteratingOverProfiles_ReturnsTheSameInstances() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act IProfile created = storage.Create("foo"); IProfile iterated = storage.First(p => p.Name == "foo"); // Assert Assert.AreSame(iterated, created); }
public void GettingAndIteratingOverProfiles_ReturnsTheSameInstances() { // Arrange FileSystemProfileStorage storage = new FileSystemProfileStorage(_fileSystem); // Act IProfile iterated = storage.First(p => p.Name == "default"); IProfile gotten = storage.Get("default"); // Assert Assert.AreSame(iterated, gotten); }
private static void RegisterApplicationTypes(ContainerBuilder builder) { IProfileStorage profileStorage; #if DEBUG_PROFILES // Debug configruation with existing profiles profileStorage = new Core.Services.Storage.InMemoryProfileStorage(new List <IProfile>() { new DesignTime.Profiles.Empty("Default"), new DesignTime.Profiles.Loser(), new DesignTime.Profiles.Winner(), new DesignTime.Profiles.FiveHundredMatches() }); #elif DEBUG_NEW_USER // Debug configuration with no profiles (new user) profileStorage = new Core.Services.Storage.InMemoryProfileStorage(); #else profileStorage = new FileSystemProfileStorage(); #endif builder.Register <IProfileStorage>((_) => profileStorage).SingleInstance(); builder.RegisterType <Core.Services.ProfileManager>().AsSelf().AsImplementedInterfaces().SingleInstance(); }