Skip to content

Commit

Permalink
Code Browser filter identification improvements + beta bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey M committed Oct 4, 2020
1 parent ec01a93 commit 6e47615
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
20 changes: 11 additions & 9 deletions DPackRx.Tests/Features/CodeBrowserViewModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ private CodeBrowserViewModel GetViewModel()

#region Tests

[TestCase("test", CodeModelFilterFlags.All, 2)]
[TestCase("test", CodeModelFilterFlags.Methods, 1)]
[TestCase("test", CodeModelFilterFlags.Properties, 1)]
[TestCase("test", CodeModelFilterFlags.ClassesInterfaces, 0)]
[TestCase("", CodeModelFilterFlags.All, 4)]
[TestCase("", CodeModelFilterFlags.Methods, 2)]
[TestCase("", CodeModelFilterFlags.Properties, 2)]
[TestCase("", CodeModelFilterFlags.ClassesInterfaces, 0)]
public void OnInitialize(string search, CodeModelFilterFlags flags, int expectedCount)
[TestCase("test", CodeModelFilterFlags.All, 2, null)]
[TestCase("test", CodeModelFilterFlags.Methods, 1, "methods")]
[TestCase("test", CodeModelFilterFlags.Properties, 1, "properties")]
[TestCase("test", CodeModelFilterFlags.ClassesInterfaces, 0, "classes and interfaces")]
[TestCase("", CodeModelFilterFlags.All, 4, null)]
[TestCase("", CodeModelFilterFlags.Methods, 2, "methods")]
[TestCase("", CodeModelFilterFlags.Properties, 2, "properties")]
[TestCase("", CodeModelFilterFlags.ClassesInterfaces, 0, "classes and interfaces")]
public void OnInitialize(string search, CodeModelFilterFlags flags, int expectedCount, string expectedTitle)
{
var viewModel = GetViewModel();

Expand Down Expand Up @@ -141,6 +141,8 @@ public void OnInitialize(string search, CodeModelFilterFlags flags, int expected
Assert.That(viewModel.FileName, Is.EqualTo("test"));
Assert.That(viewModel.Title, Is.Not.Null.And.Not.Empty);
Assert.That(viewModel.Title, Contains.Substring(" - test"));
if (!string.IsNullOrEmpty(expectedTitle))
Assert.That(viewModel.Title, Contains.Substring($" - {expectedTitle}"));
_fileProcessorMock.Verify(p => p.GetMembers(ProcessorFlags.IncludeFileCodeModel, It.IsAny<CodeModelFilterFlags>()));
_optionsServiceMock.Verify(o => o.GetStringOption(viewModel.Feature, "File", string.Empty));
_optionsServiceMock.Verify(o => o.GetStringOption(viewModel.Feature, "Search", string.Empty));
Expand Down
12 changes: 11 additions & 1 deletion DPackRx/Features/CodeBrowser/CodeBrowserViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public override void OnInitialize(object argument)
throw new ArgumentException("Invalid initialization argument", nameof(argument));

this.FileName = _optionsService.GetStringOption(this.Feature, "File", this.FileName);
this.Title = $"USysWare Code Browser - {Path.GetFileName(this.FileName)}";
_search = _optionsService.GetStringOption(this.Feature, "Search", _search);
this.Filter = (CodeModelFilterFlags)argument;
var filter = (CodeModelFilterFlags)_optionsService.GetIntOption(this.Feature, "Filter", (int)this.Filter);
Expand Down Expand Up @@ -262,6 +261,17 @@ private void ApplyMembers()
_search = string.Empty;
this.FileName = fileName;

string filter = null;
if (this.Filter == CodeModelFilterFlags.All)
filter = string.Empty;
else if (this.Filter.HasFlag(CodeModelFilterFlags.ClassesInterfaces))
filter = "classes and interfaces";
else if (this.Filter.HasFlag(CodeModelFilterFlags.Methods))
filter = "methods";
else if (this.Filter.HasFlag(CodeModelFilterFlags.Properties))
filter = "properties";
this.Title = $"USysWare Code Browser {(string.IsNullOrEmpty(filter) ? string.Empty : $"- {filter} ")}- {Path.GetFileName(this.FileName)}";

_sourceMembers.Clear();
_sourceMembers.AddRange(members); // causes filter to be evaluated
}
Expand Down
2 changes: 1 addition & 1 deletion DPackRx/Package/Beta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DPackRx.Package
/// </summary>
internal static class Beta
{
public static readonly DateTime ExpirationDate = new DateTime(2020, 10, 19).AddHours(12);
public static readonly DateTime ExpirationDate = new DateTime(2020, 12, 7).AddHours(12);
}
#endif
}
2 changes: 1 addition & 1 deletion DPackRx/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="3D22E261-32E5-46CE-A4B0-B884FA49A9A2" Version="4.0.0.33" Language="en-US" Publisher="USysWare" />
<Identity Id="3D22E261-32E5-46CE-A4B0-B884FA49A9A2" Version="4.0.0.34" Language="en-US" Publisher="USysWare" />
<DisplayName>DPack Rx</DisplayName>
<Description xml:space="preserve">FREE tools collection designed to greatly increase developer's productivity, automate repetitive processes and expand upon some of Microsoft Visual Studio features. Visual Studio 2017 and 2019 are supported.</Description>
<MoreInfo>https://github.com/usysware/dpack</MoreInfo>
Expand Down

0 comments on commit 6e47615

Please sign in to comment.