Skip to content

Commit

Permalink
(GH-1209) (c) Chocolatey Software to specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Mar 28, 2017
1 parent 3046d60 commit b93744e
Show file tree
Hide file tree
Showing 55 changed files with 1,107 additions and 758 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +20,9 @@ namespace chocolatey.tests.integration
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Reactive.Subjects;
using Moq;
using chocolatey.infrastructure.events;
using chocolatey.infrastructure.services;
using Moq;

public class MockEventSubscriptionManager : Mock<IEventSubscriptionManagerService>, IEventSubscriptionManagerService
{
Expand All @@ -34,7 +35,7 @@ public ConcurrentDictionary<Type, IList<object>> Messages

public void publish<Event>(Event eventMessage) where Event : class, IMessage
{
var list = _messages.Value.GetOrAdd(typeof (Event), new List<object>());
var list = _messages.Value.GetOrAdd(typeof(Event), new List<object>());
list.Add(eventMessage);
Object.publish(eventMessage);
}
Expand All @@ -44,4 +45,4 @@ public IDisposable subscribe<Event>(Action<Event> handleEvent, Action<Exception>
return new Subject<Event>();
}
}
}
}
14 changes: 7 additions & 7 deletions src/chocolatey.tests.integration/NUnitSetup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,17 +22,16 @@ namespace chocolatey.tests.integration
using System.Linq;
using System.Reflection;
using System.Threading;
using chocolatey.infrastructure.licensing;
using NUnit.Framework;
using SimpleInjector;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.app.builders;
using chocolatey.infrastructure.app.commands;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.licensing;
using chocolatey.infrastructure.platforms;
using chocolatey.infrastructure.registration;
using chocolatey.infrastructure.services;
using NUnit.Framework;
using SimpleInjector;

// ReSharper disable InconsistentNaming

Expand All @@ -51,13 +51,13 @@ public override void BeforeEverything()
// don't have to worry about issues using it
var config = Container.GetInstance<ChocolateyConfiguration>().deep_copy();
config.Information.PlatformType = PlatformType.Windows;
config.Information.IsInteractive = false;
config.Information.IsInteractive = false;
config.PromptForConfirmation = false;
config.Force = true;
unpack_self(Container, config);
build_packages(Container, config);

ConfigurationBuilder.set_up_configuration(new List<string>(), config, Container, new ChocolateyLicense(), null);
ConfigurationBuilder.set_up_configuration(new List<string>(), config, Container, new ChocolateyLicense(), null);

MockLogger.reset();
}
Expand Down
5 changes: 3 additions & 2 deletions src/chocolatey.tests.integration/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,4 +52,4 @@
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
14 changes: 8 additions & 6 deletions src/chocolatey.tests.integration/Scenario.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,6 +17,7 @@
namespace chocolatey.tests.integration
{
using System;
using System.Collections.Generic;
using System.IO;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.app.configuration;
Expand All @@ -24,7 +26,6 @@ namespace chocolatey.tests.integration
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.platforms;
using System.Collections.Generic;

public class Scenario
{
Expand Down Expand Up @@ -89,11 +90,11 @@ public static void install_package(ChocolateyConfiguration config, string packag
_service = NUnitSetup.Container.GetInstance<IChocolateyPackageService>();
}
var installConfig = config.deep_copy();

installConfig.PackageNames = packageId;
installConfig.Version = version;
_service.install_run(installConfig);

NUnitSetup.MockLogger.Messages.Clear();
}

Expand All @@ -108,11 +109,12 @@ public static void add_files(IEnumerable<Tuple<string, string>> files)
_fileSystem.write_file(file.Item1, file.Item2);
}
}

public static void create_directory(string directoryPath)
{
_fileSystem.create_directory(directoryPath);
}

private static ChocolateyConfiguration baseline_configuration()
{
// note that this does not mean an empty configuration. It does get influenced by
Expand All @@ -122,7 +124,7 @@ private static ChocolateyConfiguration baseline_configuration()
config.Information.PlatformType = PlatformType.Windows;
config.Information.IsInteractive = false;
config.Information.ChocolateyVersion = "1.2.3";
config.Information.PlatformVersion = new Version(6,1,0,0);
config.Information.PlatformVersion = new Version(6, 1, 0, 0);
config.Information.PlatformName = "Windows 7 SP1";
config.Information.ChocolateyVersion = "1.2.3";
config.Information.ChocolateyProductVersion = "1.2.3";
Expand Down
5 changes: 3 additions & 2 deletions src/chocolatey.tests.integration/TODO.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,4 +44,4 @@ public class TODO
*
*/
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,8 +19,6 @@ namespace chocolatey.tests.integration.infrastructure.app.services
using System;
using System.IO;
using System.Linq;
using Moq;
using Should;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.domain;
Expand All @@ -28,6 +27,8 @@ namespace chocolatey.tests.integration.infrastructure.app.services
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.results;
using chocolatey.infrastructure.services;
using Moq;
using Should;

public class FilesServiceSpecs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,10 +17,10 @@
namespace chocolatey.tests.integration.infrastructure.commands
{
using System;
using Should;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.filesystem;
using Should;

public class CommandExecutorSpecs
{
Expand All @@ -31,7 +32,6 @@ public abstract class CommandExecutorSpecsBase : TinySpec
public override void Context()
{
commandExecutor = new CommandExecutor(fileSystem);

}
}

Expand All @@ -46,8 +46,16 @@ public override void Context()
}

public override void Because()
{
result = commandExecutor.execute("cmd.exe", "/c bob123123", ApplicationParameters.DefaultWaitForExitInSeconds, fileSystem.get_current_directory(), null, (s, e) => { errorOutput += e.Data; }, updateProcessPath: false, allowUseWindow: false);
{
result = commandExecutor.execute(
"cmd.exe",
"/c bob123123",
ApplicationParameters.DefaultWaitForExitInSeconds,
fileSystem.get_current_directory(),
null,
(s, e) => { errorOutput += e.Data; },
updateProcessPath: false,
allowUseWindow: false);
}

[Fact]
Expand Down Expand Up @@ -93,4 +101,4 @@ public void should_have_an_error_message()
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2017 Chocolatey Software, Inc
// Copyright © 2011 - 2017 RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,12 +18,10 @@ namespace chocolatey.tests.integration.infrastructure.cryptography
{
using System;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using chocolatey.infrastructure.app.configuration;
using Should;
using chocolatey.infrastructure.cryptography;
using chocolatey.infrastructure.filesystem;
using Should;

public class CrytpoHashProviderSpecs
{
Expand Down Expand Up @@ -65,4 +64,4 @@ public void should_provide_the_correct_hash_based_on_a_checksum()
}
}
}
}
}
Loading

0 comments on commit b93744e

Please sign in to comment.